The CreatorCon Call for Content is officially open! Get started here.

I want to updated Opened by users correctly

JVINAY
Tera Contributor

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 = gs.getUserID();
producer.u_intake.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 " + producer.recipient.getDisplayValue();
current.insert();
 
I have updated above script highlighted lines but not working still showing Same
 
Please help me to update the code 
 
Thank you.
3 REPLIES 3

Rafael Batistot
Kilo Patron

Hi @JVINAY 

 

Right now, even though you updated your script with current.opened_by = gs.getUserID();, it still shows the original requestor’s name.

 

This usually happens because:

1. The opened_by field on current might be overridden later (e.g., by a Business Rule, Flow, or Script Include).

2. The field on the parent (u_intake.opened_by) might be used to populate the CIT instead of your manual assignment.


May you t
ry forcing the assignment after setting the parent (to avoid overwrite from copying logic).

 

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';

// Force Opened By to current user (creator)
current.opened_by = gs.getUserID();

// Do NOT overwrite the parent record’s opened_by
// producer.u_intake.opened_by = gs.getUserID(); <-- remove this line

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();

current.insert();

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.

@Rafael Batistot 

 

I have updated the Code:

 

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';
// added backend name
current.u_intake.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 " + producer.recipient.getDisplayValue();
 
JVINAY_0-1756976899522.png

Still not working, 

Thank you

 

Chaitanya ILCR
Mega Patron

Hi @JVINAY ,

 

try this 

producer.portal_redirect = "?id=cloud_request&table=u_cloud_intake_request&view=portal_view&sys_id=" + producer.u_intake;
current.parent = producer.u_intake;
current.u_cloud_task_type = 'Review';
current.short_description = 'CIR Requestor change request';
// added backend name
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 " + producer.recipient.getDisplayValue();

var intakeGr = new GlideRecord('u_cloud_intake_request');
if (intakeGr.get(producer.u_intake)) {

    intakeGr.opened_by = gs.getUserID();
    intakeGr.update();
}

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya