In workflow how to mapped the short description to another table

Suyash Joshi
Tera Contributor

Hello Everyone,

I need a small requirement regarding workflow activities.

I have an custom table in which I create a field short description I want to mapped this field into sysapproval_approver table any field in the approval record.

Can anyone help me solving my problem.

Please check an attachment in the sysapproval_approver table first I want to submit record on custom table after the request  is generate I have open the approval request I want changes in the given approval record field.

Thanks and Regards

Suyash

 

 

1 ACCEPTED SOLUTION

@Suyash Joshi 

try this -> your update line should be within IF

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id).addOrCondition('sysapproval', current.sys_id);
gr.query();
if(gr.next()){
	gr.u_short_description = current.u_short_description;
	gr.update();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Suyash Joshi 

So short description on sysapproval_approver table should get populated from short description field of your custom table record?

if yes then you can add that logic from the place where you are adding the approval

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Actually I wasn't able to run this query.

I create workflow please check the attachment I need 2 requirement in this activity.

1. Once the record is created ,approval(For any user or group) will be automatically generated . But it only showing requested while submitting the record.

2.  Short description field value from the custom table are automatically mapped to corresponding fields in the approval record. 

In the second requirement i run business rule, GlideRecord but unable to populate the field value.

My query is :-

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id','88ba7a2297dbb550a976358e6253af04');
gr.query();
while(gr.next()){
gr.u_short_description = current.u_short_description;
}
gr.update();

I have send an attachment of my workflow,

Can you help me solving my doubt?

Thanks and Regards

Suyash

@Suyash Joshi 

try this -> your update line should be within IF

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id).addOrCondition('sysapproval', current.sys_id);
gr.query();
if(gr.next()){
	gr.u_short_description = current.u_short_description;
	gr.update();
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader