Got Stuck to meet the requirement

sayanghosh0
Tera Contributor

Hello All,
1. I have created a ServiceNow Catalog(Please find the below screenshot)

sayanghosh0_0-1733466341321.png

In the Above attribute LO(core_business_capability_l0), L1(sub_business_capability_l1) and L2(sub_business_capability_l2), whenever are getting the value from cmdb_ci_business_capability table(find the screenshot)

sayanghosh0_1-1733466451516.png


 L1 is taking the parent value of L0 and showing it in the L1 field(Advance reference qualifier is used) and again L2 taking the parent value of L1 and put it in the L2(Please find the screenshot)
 

sayanghosh0_2-1733466780631.png

sayanghosh0_0-1733468118360.png

 

 


2. Now taking the Parent value from cmdb_ci_business_capability table and put it in the cmdb_rel_ci table(find the below screenshot).

sayanghosh0_4-1733467315921.png

 


3. Now take the Child from cmdb_rel_ci table and In Catalog Item  show the child name only in Business Application name(business_application_name
Note: Business Application name(business_application_name) is taking the value from table cmdb_ci_business_app.
The relationship of cmdb_ci_business_capability and cmdb_rel_ci  table is of Parent.
The relationship of cmdb_rel_ci and cmdb_ci_business_app table is of Child.

Question is:
1. Whenever L0 is not empty and L1 and L2 is empty then in Business Application name(business_application_name) Take the value of L0
2. Whenever L0 and L1 is not empty and L2 is empty then in Business Application name(business_application_name) Take the value of L1
3. Whenever L0, L1 and L2 is not empty then in Business Application name(business_application_name) Take the value of L2.

Please Help me to achieve the scenario



1 ACCEPTED SOLUTION

Arafath
Tera Guru

Hi @sayanghosh0 ,

 

I'm not very clear about how the L1 and L2 fields are populating. But the question you posted regarding logic that i understood is

 

You can create onChange catalog client script on L0 field. If value changes in L0. Use this condition

if (L0 !==" " ) && (L1==" " ) && (L2==" ") then

{ business_impact = valueOf(L0) }

 

else if (L0!==" ") && (L1 !== " ") && (L2==" ") then

{ business_impact field value = valueOf(L1) }

 

else if (L0!==" ") && (L1 !== " ") && (L2 !==" ") then

{ business_impact field value = valueOf(L2) }.

 

Hope you can try this logic to meet you requirements.

if the solution worked for you plz Accept the Solution and Mark it as Helpful so it could benefit fellow devs. Thank you!

 

Regards,

Muhammad Arafath

View solution in original post

1 REPLY 1

Arafath
Tera Guru

Hi @sayanghosh0 ,

 

I'm not very clear about how the L1 and L2 fields are populating. But the question you posted regarding logic that i understood is

 

You can create onChange catalog client script on L0 field. If value changes in L0. Use this condition

if (L0 !==" " ) && (L1==" " ) && (L2==" ") then

{ business_impact = valueOf(L0) }

 

else if (L0!==" ") && (L1 !== " ") && (L2==" ") then

{ business_impact field value = valueOf(L1) }

 

else if (L0!==" ") && (L1 !== " ") && (L2 !==" ") then

{ business_impact field value = valueOf(L2) }.

 

Hope you can try this logic to meet you requirements.

if the solution worked for you plz Accept the Solution and Mark it as Helpful so it could benefit fellow devs. Thank you!

 

Regards,

Muhammad Arafath