Hi @TechWithPri, could you please explain the use of keyword 'this' on the "user" variable, line 5? I know 'this' method connects variables of an object in a function, but in this case I am failing to connect the dots on how 'this' comes into place in this case. Thank you
@techwithpriАй бұрын
Hey 👋 When a client callable script include is called from a client script or business rule, a new instance of the script include is created. The this keyword refers to that specific instance, allowing you to access its properties and methods.
@vasukismile1839 Жыл бұрын
Just a query. Why we should avoid reference function completely? Shall we use call back reference function ? That will not affect the performance. That is asynchronous too.
@techwithpri Жыл бұрын
Hey !! Yes its true that its asynchronous and also callback function is present but getReference returns the entire record back when doing lookups, on the other hand GlideAjax script only return the necessary information which you are looking for. So GlideAjax is always a best choice 😃😃
@pandulavenkatajay Жыл бұрын
bro you did not mention how to stop the giving the role while we saving the client callable script include
@techwithpri Жыл бұрын
Hi Bro! Thank you for highlighting !! I searched this a lot but what I found is this by default can't be turn off however there is a way to solve this. Please find the link where you can find the detail - www.servicenow.com/community/now-platform-articles/privacy-on-client-callable-script-includes-instance-security/ta-p/2386648 Let me know for any concern !!
@ANINDYASUNDARHAZRA7 ай бұрын
Can we call a client callable script include from background script?
@techwithpri7 ай бұрын
Yes it can. Follow the below link to check it further - www.servicenow.com/community/developer-forum/how-to-execute-client-callable-script-include-in-background/m-p/2528806
@avia-rw6cy8 ай бұрын
Hello Sir, Please post some scenarios regarding calling of script includes in catalog client scripts, would be very much helpful. Thanking you in advance sir..
@techwithpri8 ай бұрын
Hey Thank you for your comment !! I will surely do that in my complex use case video for ServiceNow. To get access on more use case join my channel now - kzbin.info/door/q9dV0PMEdQFzD4JTCNfK3Ajoin
@nikhil.kamlekar73983 ай бұрын
Hey Pritam, I followed the steps mentioned by you but it's not working. Here is my Client Script: function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } //Type appropriate comment here, and begin script below var callerVar=new GlideAjax('getEmail'); callerVar.addParam('sys_param_name','getEmail'); callerVar.addParam('sys_param_get_user_details',g_form.getValue()); callerVar.getXML(emailDetails); function emailDetails(response){ var emailId=response.responseXML.documentElement.getAttribute('answer'); g_form.setValue('u_email',emailId); } } Script Includes: var getEmail = Class.create(); getEmail.prototype = Object.extendsObject(AbstractAjaxProcessor, { getEmail: function() { var user = this.getParameter('sys_param_get_user_details'); // Added quotes around parameter name var gRecord = new GlideRecord('sys_user'); gRecord.addQuery('sys_id', user); gRecord.query(); if (gRecord.next()) { return gRecord.email; // to return the email field from the GlideRecord } return ''; // Return an empty string if no user is found } }); Could you please review, and help me out?
@techwithpri2 ай бұрын
Hey 👋 Sorry for the late reply 😔 Please check the - callerVar.addParam('sys_param_get_user_details',g_form.getValue()); You supposed to put the field name inside of g_form.getValue() 🤓