How to fetch variables of one record producer in another record producer?

Kvb Kiran
Tera Expert

We have two record producers creating similar HRC but for different use case. They uses some similar variables for locations, country, state. I want to fetch the variables values that from one record producer to another record producer and validate the value. Post validation, i want to apply those value and make them display or mandatory.

Till now, i have tried fetching the HRC itself but came to a realisation that variables do get stored in the HRC if they were created by a record producer.

How can i fetch those variables?

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Kvb Kiran 

variables are always stored in question_answer table once Record producer is submitted

what do you mean by fetching variables from 1st record producer to another?

Do you want to auto populated variables on 2nd record producer based on 1st one?

if yes then you will require reference variable pointing to HRC Table and then use onChange client script + GlideAjax to bring the variable value and then set in your current form

AnkurBawiskar_0-1766478071309.png

 

 

💡 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

There are two fields checkbox & selectbox in both the record producers.

if 1st RP gets selected with checkbox as true and selectbox with some choice, I want to display the same values in the 2nd RP. 


i have tried fetching variables from HR case. How can i use reference variables in the glideajax?

getHRApprovalCheckandSelect: function() {

        var universal = this.getParameter('sysparm_universal');
        var getHRApprovalCS = new GlideRecord('sn_hr_core_case');
        getHRApprovalCS.addQuery('parent', universal);
        // getHRApprovalCS.addQuery('u_record_producer', gs.getProperty('rp.offer_position'));
        getHRApprovalCS.orderByDesc('sys_created_on');
        getHRApprovalCS.query();

        if (getHRApprovalCS.next() && getHRApprovalCS.variables && getHRApprovalCS.variables.is_checkbox) {
            var v = getHRApprovalCS.variables.is_checkbox.toString();
            if (v === 'true' || v === '1' || v === 'Yes') {
                value = '1';
            }
        }
        return value;

 

Regards,

Kiran.

@Kvb Kiran 

what do you mean by this line? share screenshots

if 1st RP gets selected with checkbox as true and selectbox with some choice, I want to display the same values in the 2nd RP.

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