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

Hii Perry,

Now it's working.

But when it is redirecting to catalog form in service portal it is not autoPopulating the Requestor field and category 2times coming service request choice.

 

find_real_file.png

 

Thanks,

Anjaneyulu.

Hi there,

Ok that is good, you're getting closer! 🙂

Could you please share the URL you opened to get this form to load like this? That way I can look into the Requester part further.

The issue you've described above for the duplicate category choice is happening because there is a value mismatch between the value of the Category choice on Incident table for 'service request' and the value of the Category choice variable on your catalog item for 'service request'. 

 

The easiest way to make sure these are in sync would be to update your Category variable to be Type = Select box, then set Choice table = Incident and Choice field = Category:

find_real_file.png

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,

Please Click on the link to open PDI-

User Name- anji.nalamothu475@gmail.com

Password - Honey@143

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

I am getting error message for User name or password invalid when I try to login.

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Hii Perry,

please try like this

https://developer.servicenow.com/dev.do

use same user name & password.