You need to sign in to do that
Don't have an account?
Harsha Shri
One child record should have one Parent
Hi All,
I have two object one is Bank__c and another one is customer__c. Customer data I am getting from external system (SAP). From SAP I will select the customers and then I will select the bank to map. All customers will showing everytime. If Customer1 is linked to Bank1 then Customer1 sholud not be allowed to map to another Bank. How can I do this?
Please help me.
Thanks in Advance
I have two object one is Bank__c and another one is customer__c. Customer data I am getting from external system (SAP). From SAP I will select the customers and then I will select the bank to map. All customers will showing everytime. If Customer1 is linked to Bank1 then Customer1 sholud not be allowed to map to another Bank. How can I do this?
Please help me.
Thanks in Advance
- Create a text field on Customer and call it CustomerBankKey__c. Please mark this field as Unique.
- Whenever a Customer is linked with a Bank, populate the CustomerBankKey__c field with a underscore concatenated value of Customer Record Id and Bank Record Id.
Due to the unique constraint, the CustomerBankKey__c value would be unique and would flag an error in case the same customer and bank key combination occurs.All Answers
before you insert the Customer record , check if the customer is already maped with a bank , if its not go ahead and insert else disaply an error message
Step 1:
Create a custom field on the customer__c object. Make the field unique. This field would be used to hold the ID of the associated Bank__c .
Step 2:
Create a Workflow rule on customer__c . Update the custom field with the value of the associated Bank__c ID.
When you try to add a second customer__c to the Bank__c , the "unique" constraint would be violated and an error would be thrown.....
- Create a text field on Customer and call it CustomerBankKey__c. Please mark this field as Unique.
- Whenever a Customer is linked with a Bank, populate the CustomerBankKey__c field with a underscore concatenated value of Customer Record Id and Bank Record Id.
Due to the unique constraint, the CustomerBankKey__c value would be unique and would flag an error in case the same customer and bank key combination occurs.