Populate field values in catalog form in service portal by clicking UI Action button

Anjaneyulu1
Giga Contributor

Hii All,

I have a requirement.

1. Create a new Category 'Service Request'.
2. Create Service Catalog with name 'Service Request for Incidents' with variables - Requestor(Type - Reference), Category (Type - Choice; with same options as in Incident), Short Description(Type - String), Description(Type - String), Currency( Type - Currency).
3. Create UI Action 'Çreate SR' which should be visible only when category is 'Service Request'.
4. On click of this button , it should redirect to catalog created in point no.2 and variables(Caller in Requestor, Category , Currency, SHort Description) should be auto- populated in catalog page with values available in Incident form.

 

-->I have done 1,2&3 points.

-->im struck at 4th point.

-->please help me in the 4th point how to sort it out.

 

Thanks,

anjaneyulu.

1 ACCEPTED SOLUTION

Ok thanks - so the reason requester is not getting populated is the name of your variable is actually 'requester', so I updated line 5 of your onLoad 'Incident details' catalog client script accordingly and it is now working:

g_form.setValue('requester', caller);

URL: https://dev89219.service-now.com/sp?id=sc_cat_item&sys_id=75732e4b1b564110dc0f40c6cc4bcb67&sysparm_caller=6fadf5f21bca0110dc0f40c6cc4bcb6b&sysparm_category=Service%20Request&sysparm_shortDescription=wert

Screenshot:

find_real_file.png

I also went back and set all the choices you created for your Category variable to have Inactive = true since they are no longer needed due to Choice table/field configuration, and this resolved the duplicate Service Request choice issue as well.

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

View solution in original post

24 REPLIES 24

Ok thanks - so the reason requester is not getting populated is the name of your variable is actually 'requester', so I updated line 5 of your onLoad 'Incident details' catalog client script accordingly and it is now working:

g_form.setValue('requester', caller);

URL: https://dev89219.service-now.com/sp?id=sc_cat_item&sys_id=75732e4b1b564110dc0f40c6cc4bcb67&sysparm_caller=6fadf5f21bca0110dc0f40c6cc4bcb6b&sysparm_category=Service%20Request&sysparm_shortDescription=wert

Screenshot:

find_real_file.png

I also went back and set all the choices you created for your Category variable to have Inactive = true since they are no longer needed due to Choice table/field configuration, and this resolved the duplicate Service Request choice issue as well.

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Hii Perry,

it's working now perfectly.

 

Thank you so much.

Hii Perry,

Last one

ln my PDI having an issue regarding worknotes in Incident & Incident Tasks.

If i post worknotes in incident .

that worknotes should populate in all incident tasks & Vice versa incident tasks to incident.

worknotes are coming 3times in incident & incident tasks.

please check the Business Rules Once & let me know why it is performing like that.

I already posted this requirement in community no one given correct answer for me

Give me reply on this post 

https://community.servicenow.com/community?id=community_question&sys_id=abebf0c71b8a8990c790ece6b04bcb53

 

Thanks,

Anjaneyulu.

Hey Anji,

Sure thing - I just posted a reply on that thread, I think you should be good to go there.

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Hi Chris,

 

For the same type of requirement, how can we copy the attachment to the catalog form using ui action along with other fields?

 

Thanks