API Cart Submission setting opened by to the same user on every submission.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2022 02:53 PM
- External form passes json payload to a scripted rest api based around the OOB submitOrder().
- This process works as expected. Values for requested_for and opened_by are being assigned to the REQ.
- I have had no issues with the code being used to generate the request, or with any of the RITMs generated.
- After submission, all values are correct.
The issues is happening when the initial request is created. An activity record is being created as using the same user:
The problem is not that it logs the activity. The problem is the fact that it is picking this particular user every time this API is called.
I saw several posts suggesting how to set opened_by using a business rule, which is an option, however that does not answer the question as to why the system is picking the same user whenever this API generates a request.
At the start of my submission I do use gs.getUser() to create the passthroughs for the opened by and requested for. Is this my problem? If so, why would it pick the same user every time, then correctly set the values after the request has been created?
var curUser = gs.getUser();
var request_body = request.body.nextEntry();
var openedByID = curUser.getUserByID(request_body.incomingID).getID();
var openedByName = curUser.getUserByID(request_body.incomingID).getDisplayName();
var requestedForID = curUser.getUserByID(request_body.requested_for).getID();
var requestedForName = curUser.getUserByID(request_body.requested_for).getDisplayName();
if(requestedForID == null){
requestedForID = curUser.getUserByID('new.access').getID();
requestedForName = curUser.getUserByID('new.access').getDisplayName();
}
I plan on removing this section of code for testing, but I figured I would post here to see if anyone had any insight.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2022 07:29 AM
We figured out the issue. The system is functioning as expected.