The CreatorCon Call for Content is officially open! Get started here.

Unable to call the script include in scoped app

Rakesh50
Mega Sage

Hi,

 

We have 'nums' script include and it has few table sys_id's so which we used whenever it required. We have scoped application and' nums' SI also in same scope. We also have 'practice' reference field and it has 3 records and we stored this sys_id's in 'nums' SI. Now we have a requirement that if 'practice' field is 'service' we have to populate some fields.

for that i tried below script but that is throwing this below error.

onChange script error: ReferenceError: nums is not defined function () { [native code] }

 

 

 

ClientScript:- 
if(newValue.length > 0) {
		var isServices = newValue == nums.practice.Services;
		alert(isServices);
   g_form.setDisplay('requested', true);
}
Script Include:-
 var nums = {
  
    country : {
        other: "661fdeaddbb8c0106982e2e3ca9619d2"
    },
    practice: {            
        Services: "da56ad1f474ae11060475a37e26d43c8",                  
        Security: "9e60b9c5970a2d504dc2f5efe153af4b",         
        Social: "2abddab1871969103208113e3fbb3537",
    },
};

 

 

@AnveshKumar M 

 

10 REPLIES 10

Hi @Ankur Bawiskar 

I have added alert but not getting. But in form level under the practice field i'm getting below error

Rakesh50_0-1682695915909.png

 

Client script:- 

if(newValue.length > 0) {
		var isManagedServices = newValue == Enums.practice.Services;
              alert(isManagedServices ); // alert
		if(isManagedServices) {
			var queue = g_form.getValue('u_queue');
			if(newValue.length > 0 && queue.length > 0) {
				var queues = Enums.queues.assignee.Queue(newValue);
				g_form.setMandatory('requested, (queues.L1_CAT == queue || queues.L2 == queue));	
			}
		} else {
			g_form.setMandatory('requested', false);
		}