Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how to create variable which displays Price (always US Dollars)

Deepa12
Tera Contributor

Hi,

Please advise to create variable for catalog item which is always show US dollar currency.

This variable value comes from the table software table annual cost (customized field). Thanks.

 

7 REPLIES 7

GlideFather
Tera Patron

Hi @Deepa12,

 

it depends on many details. The variable can be a string (ev. single line text) and the value from the table can be fetched via glideAjax..

 

Please share what you tried and where you failed to help you

_____
100 % GlideFather experience and 0 % generative AI

I have created single line text type for the variable - annual unit cost, annual total cost.  set the default value $. then i have created catalog client script to set annual unit cost, total cost with $ symbol.

if(softwareName.u_license_subcategory == 'Microsoft'){
            g_form.setDisplay('annual_unit_cost', true);
            g_form.setDisplay('annual_total_cost', true);
            g_form.setValue('annual_unit_cost', '$' + softwareName.u_annual_unit_cost);
 
            var qty = g_form.getValue('quantity');
            var cost = g_form.getValue('annual_unit_cost');
            var cost_val = qty * cost;
            g_form.setValue('annual_total_cost', '$' +cost_val );
}

Tanushree Maiti
Giga Sage

Hi Deepa12,

 

Please check this community post . They are making a currency variable.

 

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

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Ankur Bawiskar
Tera Patron

@Deepa12 

there is no currency variable available OOTB.

You will have to use Single line text variable and ask user to enter in Dollar.

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader