Mapping Capability to business application through customization on business application form.

vijay_sangewar1
Tera Contributor

Hi all,  I have a requirement to create a relationship or map a capability with business application through a custom field on business application form. 

The custom field 'u_business_capabilities' on Business Application (cmdb_ci_business_app) Table is a list type field and referencing Business Capability Table (cmdb_ci_business_capability). 

When I select business capability in this list type field a relationship should get created on cmdb_rel_ci table also it should be displayed in related items.
To achieve this I have used a Business Rule and when to run condition is When 'u_business_capabilities' changes.
Please find the script for the same in the attached file. 
Also If I Have a business rule on cmdb_rel_ci table. If I add Capability through OOB way through related item then this business rule will add the same capability to custom field.
Now the issue which I am facing is when I am adding Capability through related Item it is getting added in custom field 'u_business_capabilities' because of Business rule which is running of cmdb_rel_ci table but at the same time when 'u_business_capabilities' field is getting changed and it is triggering Business rule which is on Business Application table.
And I am getting duplicate Relationship Record.
Please advice me the changes in the attached script so that when I Select capability through custom field it should first check if current Relationship already exist and if yes it should not create duplicate one.

Thank you.

0 REPLIES 0