AddToCart change default login user

Wei_ Ling
Tera Guru

I use Cart for Draft use, I need to generate a draft record when the approver clicks, but the addToCart method defaults to the current logon user, is there any way to switch this user to someone else?

Wei_Ling_0-1724229345856.png

 

1 REPLY 1

aizawaken
Tera Guru

Hi @Wei_ Ling 
I don't know my comment is fit for your point, but let me comment as below.

I just take a look around this page, and I found 2 methods to update sys_user's id  into "requestd_for".
One is "submitOrder()", and the other is "setRequestedFor()". 

But it seems that the timing is different to be affected.
Not the timing of "addToCart", but the timing of "submitOrder" from the cart.

What do you think of using "setRequestedFor()" to replace the user?

Thanks,