Record Producer --> Incident

ajaynalabol
Tera Contributor

Hello Servicenow Family,
Can someone please help me on this.
Thank in advance!.


When the user submit the below catalogue form,.. below is the code for
populate when user category

var cat = g_form.getValue('category');
    if (cat == A&T Card') {
        g_form.clearOptions('card_incident');
        g_form.addOption('card_incident', ''new_ applcaition, ' New application', 100);
        g_form.addOption('card_incident', 'card_limit', 'Card Limit increase', 300);
        g_form.addOption('card_incident', unnblock_request', 'unblock request', 200);
        g_form.addOption('card_incident', 'Other queries', 'Other queries', 400);
    } else if (cat == 'T&E Card') {
        g_form.clearOptions('card_incident');
        g_form.addOption('card_incident', 'card_queries', 'card Queries', 100);
        g_form.addOption('card_incident', 'limit_increase', 'Limit increase', 300);
        g_form.addOption('card_incident', 'unblock_request', 'Unblock request', 200);

}

ajaynalabol_0-1766400129985.png
After submitting the form,  the data is transform into incident form,  automatically (Record prodcuer catalog item), please write acode for the below requirement
Assignment group=' abc,
Configuration item = 'asd;
Service = ' T*E '
Category should be='Travel'
sucategory = ' Ticket booking'
Short descrption will be = 'select category' + ' |  ' 'select card incindent';
Description is =(please provide information)

 

ajaynalabol_1-1766400222830.png

 

3 REPLIES 3

RaghavSh
Mega Patron

This is a simple record producer script.

 

current.assignment_group.setDisplayValue('assignment_group_name'); 

current.cmdb_ci.setDisplayValue('ci name'); 

current.service_offering.setDisplayValue('service name'); 

current.category='';// pass. cat value

current.subcategory=''; // pass subcat value

current.short_description = producer.category + " | " +  producer.card_incident;

current.description = "(please provide information)"

 


Raghav
MVP 2023
LinkedIn

Hemanth M1
Giga Sage
Giga Sage

Hi @ajaynalabol ,

 

Since its a record Producer, use record producer script as below

current.setValue("assignment_group", "sys_id of the assignment group abc");
current.setValue("configuration_item", "sys_id of the configuration item");
current.setValue("service", "sys_id of the service"); //since its a reference field
current.setValue("category", "Travel");
current.setValue("subcategory", "Ticket Booking");
current.setValue("short_description", Producer.select_category_backend_name+" "+"|"+" "+Producer.Select.Card_backend_name);
current.setValue("description", Producer.please_provide_details_variable_name_bakend_value);
current.update();

/* 
1)please check variable backend value ands replace accordingly
2)use system property instead of direct sys_ids"
*/

 

Record Producer script - location 

HemanthM1_0-1766402466048.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Ankur Bawiskar
Tera Patron
Tera Patron

@ajaynalabol 

so what did you write and what's not working?

It's an easy requirement.

Unless you write you won't learn.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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