You need to sign in to do that
Don't have an account?
MC34
Concatenating values from Child Objects to Parent Object
I have two objects:
Case and custom object [Questions__c] and with master detail relationship.
So when a child record is inserted or updated I want add values of Message_Text__c (one child record) entered and added with the value of Message_Text__c (another child record) to the Case custom field Clarification _description__c with comma seperated(field1__c,Field2__c).
If there are multiple child records I want to seperate them with ':' for example :field1__c,Field2__c:field1__c,Field2__c....
below trigger code is not working :(
Show here on child record:
Thank you.
Mit
Case and custom object [Questions__c] and with master detail relationship.
So when a child record is inserted or updated I want add values of Message_Text__c (one child record) entered and added with the value of Message_Text__c (another child record) to the Case custom field Clarification _description__c with comma seperated(field1__c,Field2__c).
If there are multiple child records I want to seperate them with ':' for example :field1__c,Field2__c:field1__c,Field2__c....
below trigger code is not working :(
trigger UpdatingCase on Questions__c(after Insert, after Update) { List < Case > poList = new List < Case > (); Set < Id > Po_Ids = new Set < Id > (); for (Questions__c childObj: Trigger.new) { Po_Ids.add(childObj.ParentLookup__c); } if (Trigger.IsInsert || Trigger.IsUpdate) { List < Case> po = [Select Id, Clarification_Description__c, (Select field1, field2 from Child__r) from Case where Id IN: Po_Ids]; for (Case p: po) { String concatenateString = ''; for (Questions__c c: p.Child__r) { concatenateString += c.Message_Text__c + ',' + c.Message_Text__c + ' : '; } p.Clarification _description__c = concatenateString; poList.add(p); }This is what i want to achieve:
Show here on child record:
Thank you.
Mit