Sharepoint 2013 workflow history change user ID - sharepoint-2013

I'm creating a custom workflow in Sharepoint 2013 with Visual Studio for the approval of the elements added to a list. It's as simple as: A user creates the element (initiator) and a different one approves it (approver).
The problem comes when I use the WriteToHistory box to leave trace of the steps. The User ID in the history item that is created is always the initiator and there's no evident way of changing it. Therefore, I thought I could replace the WriteToHistory element with a CreateListItem to create the history item and all its fields manually. When I do so, I can update all of the fields in the history item (even the WorkflowInstance value, that links this new history item with its workflow instance) but not the User ID...
I'm getting the error when the workflows runs and tries to add the new history item
Retrying last request. Next attempt scheduled in less than one minute.
Details of last request: HTTP BadRequest to <siteURL>/_vti_bin/client.svc/web/lists(guid'<workflowHistoryListGUID>')/Items
Correlation Id: 42e20e0f-61d2-4a35-9339-429d395dbdfb Instance Id: c329fba8-dbbd-4123-8411-b90a34ec8fbb
I don't know which items the last two GUIDs refer to. Additional information:
I'm setting the User ID field using its internal name. This field type is a person or group but I don't know how to create an SPUser in the workflow. I've passed a GUID and an Int32 with the user id and nothing changed
I'm not providing values for all the mandatory fields
The rest of the fields work perfectly whatever their types are: string, dates, etc.
Can anybody advise the way of customizing the User ID in the history items? Thanks

Related

What's the best practice to implement "read receipts" on group chats in AWS AppSync and Amplify?

I'm building an Angular 11 web app using AppSync for the backend.
I've mentioned group chat, but basically I have a feature in my app where I have an announcement feature where there's a person creating announcements to a specific audience (can be individual members or groups of members) and whenever the receiving user opens the announcement, it has to mark that announcement as read for that user in their UI and also let the sender know that it has been opened by that particular member.
I have an idea for implementing this:-
Each announcement needs to have a "seenBy" which aggregates the user Ids of the ones who open it.
Each member also has an attribute in their user object named "announcementsRead" which is an array of Ids of the announcements that they have opened.
In the UI when I'm gathering the list of announcements for the user, the ones whose ID don't belong in the member's own announcementsRead array, will be marked as unread.
When they click on it and it is opened, I make 2 updates - a) To the announcement object I simply push the member's user ID to the "seenBy" attribute and push to db. b) to the member's user object, I add the announcement's id to the "announcementRead" attribute and push it to the DB.
This is just something that I came up with.
Please let me know if there are any pitfalls to this approach. Or if there are simpler ways to achieve this functionality.
I have a few concerns as well:-
Let's say that two users are opening an announcement at the same time, and the clients try to update the announcement with the updated seenBy containing the user's ID, what happens when the two requests from two different clients are happening concurrently? It's possible that the first user fetches the object and then the second user fetches it immediately, and by the time the second user has updated the attribute and sent it back to the DB, the first user has already written their updated data. In such a case the second user's write to the DB will overwrite the first user's change. I am not sure of the internal mechanisms of the amplify data store, but I can imagine this happening. Is this possible? If so, how do we ensure that it is prevented?
Is it really necessary for me to maintain the "announcementsRead" attribute in the user? I mean I can imagine generating that list in the UI every time I get the list of announcements by checking if the current user's ID exists in the announcement's "seenBy" and maintaining that list in the UI, that way we can eliminate redundancy of info in the DB and also it would make sense to not accumulate extremely old announcement IDs that may have been deleted. But I'm wondering if having this on the member actually helps in an indispensable way.
Hope my questions are clear.

How to know who is submitting a form in oracle apex?

I have an app where a user must be logged in to post an advertisement visible to others. How can I associate that person's unique id to that posting? Is there a way to fetch their attributes once they are signed in?
edit: each user submits a form to add the posting to the db.
I have the practice of putting triggers on every remotely important table.
Each of these tables includes 4 fields, date of insert, user who inserted, date of last change, user of last change.
Then the trigger just fills these fields with SYSDATE and APP_USER.
This way we get to see who inserted each data, and if it was later changed, we also see that.
For more important tables you should also have history, either the built in history, or a table into which each change is logged.
Each user will have a unique value in the :APP_USER substitution string.

How to provide permission to the user to access only one column in the created Microsoft Lists?

Am new to Microsoft Lists and trying to implement the library management system. Have prepared a list to show the book details using the 'From Excel' list. Need to restrict the permission based on the user role(admin, client).
For example, If a user needs to request a book, there might be a column to access for the user to send a request for the desired book. So that, an admin will get notified for the request and take action.
Similarly, from the list i created, i need to provide permission to the user to access only one column. The rest of the column can only be for view purposes.
Note: As i searched i found we can set permission like view, view, and edit, and stop sharing the list based on the roles of Members, Owners, and Visitors.
Could anyone please guide me on this?
Regards,
Vadivel
#Karthi,
It's not possible to configure column permission, the least permission is item-level. There is no column-level or view level permission.
Here are 2 possible solutions:
Make the target column read-only. Then develop another interface for the administrator to manage the data. For example, through SharePoint rest API, we can turn the column back to editable and post updates then immediately turn it to read-only.
Check Set List Column Read Only in SharePoint using PowerShell
How to update read only field
Hide the target column and make a calculated column then set its value equal to the target column. The user will only see those calculated columns, any updates on the target column will be reflected in calculated columns.
Check Make SharePoint Columns read-only without coding

Update only specified fields of PrestaShop product via API

I would like to know if there is a way to update a ressource (product in this case), but only update fields that are specified in my request.
For example, let's say I want to update only the required fields for the product, but not change the others, how could I proceed via the webservice ?
As far as I know, when you update a ressource, it will update it as whole : This means if you don't "re-send" the original value back when updating (if you do not specify ALL the fields), it is considered as empty.
From my tests, I tried the following :
Log in my PrestaShop, get a random product, set the "width" to a random value (let's say 30 cm)
Retrieve the blank schema of a product, and fill only the required fields of the schema (width is not part of it)
Send the schema via the webservice to update the original product using a PUT request
Get back in my PrestaShop and notice in despair and sadness that the width value has been set to 0
My use case is that we have a system that is synching products with PrestaShop. When a product is edited in our system, a specific set of fields is sent back to PrestaShop so the product in the shop is also updated.
But for some of our users, they want to be able to add information on the shop and keep them even if the product is updated afterwards. For example, they add dimensions to the product (fields that are not managed / persisted in our system) and they want to keep those information.
The constraint we have is that the set of fields sent for updates is "hardcoded" : We can't get the ressource schema and update it to send it back afterwards.
Is there any parameter / configuration that can be set so values of fields that are not specified are not erased ?
Due to the nature of how the PrestaShop API works, you can perform the following:
For each product you want to update, you can pull the complete object (with all fields), then update that object with only the fields you need updated, and then push the whole object as n update for that product via the API.
Doing this for multiple products will require twice the API calls.. but this is one workaround.
One way is to use a flag variable for the properties which you want to update

Only allowing Sitecore users to see their own items in Workflow

Is there a way to allow users to see workflow, but only allow them to see their own items within the workflow?
This seems like a problem that would be common. You have a large number of content creators and you only would want them to see how their content is moving in workflow, not the content created by others.
Possible (approximate and messy) solution:
The only possibility I could think of would be to turn off rights inheritance so that I could explicitly deny viewing rights to workflow. Then with a custom action in workflow I could explicitly turn on view rights to each item a user submits.
Am I on the right track? I hope not. ;)
Question Clarification:
I want approvers to see everything, but I want authors to open workflow and only see their own items, not dozens of items from other authors.
This is not the default behaviour as the common use of workflow is for an approval process. In that case the approval team would log in and see the items waiting for approval from the authoring team, if they could only see the items they created then they wouldn't see anything at all.
One way I can think of doing this would be to override the codebeside for the workbox application. Take a look at this file Website\sitecore\shell\Applications\Workbox\Workbox.xml and it's codebeside class Sitecore.Shell.Applications.Workbox.WorkboxForm. If you put your own class in here you could probably add all the logic you need to the 'GetItems' method.
Attacking this from another angle, given you want visibility to the authors on if their items have been approved or not, instead of giving them access to the workbox, why not add a customised email action to the approved status (or the approve command) so that the authors receive an email when their item has been approved. You could also customise the email so that it includes a link to the approved item or includes details of the item so that the author can identify the individual item if they have authored multiple items.
There is a sample email action in the Sitecore.Workflows.Simple.EmailAction class in the Sitecore.Kernel assembly that you can use as a base to your customisations.
If you want to make sure that all items are being approved within a certain timeframe, you could also use the ASR shared source module to generate reports on items that have not been approved within a certain timeframe and have it automatically email this report on a regular basis.