Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Advanced Reference Qualifier Work Both Ways - Parent and Child

Carter1
Giga Guru

I have 2 reference fields displayed on a form, "Service" and "Service Offering". There is a parent-child relationship between these 2 fields. One Service can have many Service Offerings, Service Offering will only ever be associated with 1 Service.

 

I currently have an advanced reference qualifier restricting the list of Service Offerings depending on the "Service" selected (working fine):

 

javascript: 'service= + current.service;

 

The requirement I've been given is to allow users to make a selection at the service offering and have the service field back fill. But some users will first select a service and then proceed to select from the narrowed down list of Service Offerings so I want it to account for both scenarios.

 

Can anyone help with how I can write an advanced reference qualifier that can work "both ways" ?

1 REPLY 1

Slava Savitsky
Giga Sage

Assuming that the names of your fields are "business_service" and "service_offering", you could use the following code in the reference qualifier of the Service field:

javascript: var ref_qual = ''; var service = current.service_offering.parent; if (service) ref_qual = 'sys_id=' + service; ref_qual;

 

You could also define it as a function in a Script Include and call it from the reference qualifier.

 

For the Service Offering field, I think you can do without a reference qualifier. Instead, you can configure Service Offering to be dependent on Service by putting "business_service" into the Dependent field in the dictionary entry of the Service Offering field.