I want to update the Opened by user

JVINAY
Tera Contributor

Hi Team ,

My requirement is :

Update requests CITs to reflect correct associate.  

 

Currently, any Cloud task created is showing the original requestor's name instead of the actual creator's name. I want it to correctly display the name of the person who created the CIT in the 'Opened by user' field

 

Opened by :  u_intake.opened_by 

 

 

Existing  Record producer Script :

producer.portal_redirect = "?id=cloud_request&table=u_cloud_intake_request&view=portal_view&sys_id=" + producer.u_intake.sys_id;
current.parent = producer.u_intake;
current.u_cloud_task_type = 'Review';
current.short_description = 'CIR Requestor change request';
current.opened_by = producer.recipient;
current.assignment_group = '1a527886dbe9bb40ee5c24f40596194d';
current.description = "Please work on the change of CIR requestor to " + producer.please_select_new_requestor.getDisplayValue() + " as per the justification : " + producer.please_provide_reason_for_change + " given by " + producer.recipient.getDisplayValue();
 

 

 
 
Please help to update the Script.
 
Thanks in advance .

 

:

9 REPLIES 9

Shashank_Jain
Kilo Sage

@JVINAY ,

 

Try the below updated script -

producer.portal_redirect = "?id=cloud_request&table=u_cloud_intake_request&view=portal_view&sys_id=" + producer.u_intake.sys_id;
current.parent = producer.u_intake;
current.u_cloud_task_type = 'Review';
current.short_description = 'CIR Requestor change request';

// Set opened_by to the logged-in user instead of CIR requestor
current.opened_by = gs.getUserID();

current.assignment_group = '1a527886dbe9bb40ee5c24f40596194d';
current.description = "Please work on the change of CIR requestor to "
    + producer.please_select_new_requestor.getDisplayValue()
    + " as per the justification: "
    + producer.please_provide_reason_for_change
    + " given by " + gs.getUserDisplayName();

 

Hope it helps!

 

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@Shashank_Jain 

Thanks for your response

 

It's working, but I want to update the 'Opened by' field (U_intake_opened_by) as well.
The 'Opened by' user details are showing correctly in the Notes section, but in the 'Opened by' field, it still shows the CIR requestor's name. Could you please help me update the code?

 

JVINAY_1-1756808561112.png

Thanks for support.

@JVINAY you can map the field as per my comment above, it would be no code

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@JVINAY ,

 

Try this updated code for (U_intake_opened_by) field.

producer.portal_redirect = "?id=cloud_request&table=u_cloud_intake_request&view=portal_view&sys_id=" + producer.u_intake.sys_id;
current.parent = producer.u_intake;
current.u_cloud_task_type = 'Review';
current.short_description = 'CIR Requestor change request';

// Set both Opened by fields
current.opened_by = gs.getUserID();             // OOTB Opened by
current.u_intake_opened_by = gs.getUserID();    // Custom Opened by

current.assignment_group = '1a527886dbe9bb40ee5c24f40596194d';
current.description = "Please work on the change of CIR requestor to "
    + producer.please_select_new_requestor.getDisplayValue()
    + " as per the justification: "
    + producer.please_provide_reason_for_change
    + " given by " + gs.getUserDisplayName();

 

If the response was helpful, could you please mark both the solutions as accepted. That will be much appreciated.

Thank you!

 

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@Shashank_Jain 

This line not working : 

current.u_intake_opened_by = gs.getUserID();    // Custom Opened by

 

Code is not working Showing Opened by field incorrectly. This is showing CIR requestor instead of  CIT Requestor.

 

Ex : 

I created the CIT, but the 'Opened by' field is incorrectly showing the original CIR requestor's name instead of mine

JVINAY_0-1756973280346.png

 

Please help me to update the code or any other solution.

 

Thank you