You need to sign in to do that
Don't have an account?
Nidhi Sharma 3
More than 10 values in a set gives me '........' please help!!!!
Hi,
Scenario is when child object is inserted or updated then Multi-select picklist gets updated with the values.
Of course it has to be unique hence this is why I am utilizing the Set method.
So for example:
If child object (Account Market) related to Account has 12 records all active, values are A;B;C;D;E;F;G;H;I;J;K;L
the insert to the Market Type multi-picklst field on Account comes up as A;B;C;D;E;F;G;H;I;J...
After the 'J' value why is it inserting '...' ???????
Here is my code, what is incorrect please help...
Nidhi
Scenario is when child object is inserted or updated then Multi-select picklist gets updated with the values.
Of course it has to be unique hence this is why I am utilizing the Set method.
So for example:
If child object (Account Market) related to Account has 12 records all active, values are A;B;C;D;E;F;G;H;I;J;K;L
the insert to the Market Type multi-picklst field on Account comes up as A;B;C;D;E;F;G;H;I;J...
After the 'J' value why is it inserting '...' ???????
Here is my code, what is incorrect please help...
trigger ConcatenateAcctMarketType on Account_Market__c (after insert, after update) { // variable declaration.... Public Set <id> AcctIdSet = new Set<id>(); Public Set <id> AcctParentIdSet = new Set<id>(); Public List<Account> AcctList = new List<Account>(); Public List<Account> AcctChildList = new List<Account>(); Public String [] tempvar ; Public String[] tempvartest; Set<String> subAccNames = new Set<String>(); Public String Tempvar2; //DealerGroup Variables.... String [] TempVarDG ; String Tempvar2DG; Set<String> UniqueMarketTypesDG = new Set<String>(); For(Account_Market__c AcctMkt : Trigger.New) { AcctIdSet.add(AcctMkt.Account__c); } AcctList = [SELECT id,Market_Type__c, Test_Market_Type__c ,ParentId ,(SELECT Market_Type__c,Status__c, Account__c FROM Account_Markets__r WHERE Status__c = 'Active') FROM Account WHERE ID IN :AcctIdSet]; system.debug('AcctList '+AcctList); // update dealergroup logic.... For(Account Acts : AcctList ) { if (Acts.ParentId != NULL ) { AcctParentIdSet.add(Acts.ParentId); } } system.debug('AcctParentIdSet---->>'+AcctParentIdSet); // end of creating delaergroup set.... for (Account acc : AcctList) { system.debug('Account List size-->>'+AcctList.size()); for(Account_Market__c mktyp: acc.Account_Markets__r) { system.debug('mktyp List size-->>'+acc.Account_Markets__r.size()); if (acc.id == mktyp.Account__c &&mktyp.Status__c == 'Active') { if(mktyp.Market_Type__c != NULL ) { // to avoid null pointer exception.... system.debug('Market_Type__c--->>'+mktyp.Market_Type__c); Tempvar = + mktyp.Market_Type__c.split(';'); system.debug('Tempvar--->>'+Tempvar); } //if(subAccNames.size()!= 10){ subAccNames.addAll(Tempvar ); //} system.debug('subAccNames-->'+subAccNames); Tempvar2 = String.valueof(subAccNames); system.debug ('Tempvar2 49'+Tempvar2); if(Tempvar2 != null) { if(Tempvar2.contains('{')) { Tempvar2 = Tempvar2.replace('{', ' '); } if(Tempvar2.contains('}')) { Tempvar2 = Tempvar2.replace('}', ' '); } if(Tempvar2.contains(',')) { Tempvar2 = Tempvar2.replace(',', ';'); } If(Tempvar2==null) { Tempvar2=''; } } } system.debug('Tempvarssss2'+Tempvar2); } acc.Market_Type__c = tempvar2; acc.Test_Market_Type__c = String.valueof(subAccNames); system.debug('acc.Market_Type__c--->'+acc.Market_Type__c); if (Tempvar != NULL) { Tempvar.clear(); } subAccNames.clear(); Tempvar2 = ''; } system.debug('AcctList '+AcctList); update AcctList ;Thanks
Nidhi
It is not adding "....." in you SET variable. I believe you are seeing those dots in debugs only. In debugs when number of elements hit specific limit in that case debug start showing with ...
like 17:35:52.041 (41788869)|USER_DEBUG|[22]|DEBUG| @@@@@@@@@@@ --- {a, b,c,d,e,f,g,h,i,.....}
did you ever find a solution for this?