You need to sign in to do that
Don't have an account?
how to assign a string value to list
Hi Community,
From dupeBlocker i receive an id with size of x=18.
But i need only 15 letters from x like y=15
and use it in a soql query
example
values = Select id , name from Account where Account.Id =: ( y);
for this purpose i wrote code as follows . But no result.
Integer i;
List<String> s = new List<string>();
CRMfusionDBR101__Potential_Duplicate__c[] crmDupeIds = [select CRMfusionDBR101__Account__c from CRMfusionDBR101__Potential_Duplicate__c];
System.debug('****************DupeValue 11---'+crmDupeIds);
if(crmDupeIds.size() > 0 && showdups == false ){
for(i = 0; i <> crmDupeIds.size(); i++){
s = string.valueof(crmDupeIds[i].CRMfusionDBR101__Account__c);
s.substring(1,15);
Any body can help me in this regard. i also provide the trimmed debuglog
ANY) 13:34:08.888 (1888986000)|USER_DEBUG|[148]|DEBUG|****************DupeValue 11---(CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000056A4iIAE, Id=a0iW00000004mnoIAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W000000569unIAA, Id=a0iW00000004mnKIAQ}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000055o5YIAQ, Id=a0iW00000004mdjIAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000055oPWIAY, Id=a0iW00000004mdkIAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000056A73IAE, Id=a0iW00000004mo3IAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000056A6jIAE, Id=a0iW00000004mnyIAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W000000569xwIAA, Id=a0iW00000004mnUIAQ}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000055oQ2IAI, Id=a0iW00000004mdoIAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000056HsGIAU, Id=a0iW00000004mx3IAA}, CRMfusionDBR101__Potential_Duplicate__c:{CRMfusionDBR101__Account__c=001W00000056A6gIAE, Id=a0iW00000004mrCIAQ}, ...) 13:34:08.889 (1889011000)|SYSTEM_METHOD_EXIT|[148]|System.debug(ANY) 13:34:08.889 (1889071000)|SYSTEM_METHOD_ENTRY|[149]|LIST.size() 13:34:08.889 (1889103000)|SYSTEM_METHOD_EXIT|[149]|LIST.size() 13:34:08.889 (1889128000)|METHOD_ENTRY|[149]|01p50000000DMvl|NewCustomerControllerExt.__sfdc_showDups() 13:34:08.889 (1889151000)|METHOD_EXIT|[149]|01p50000000DMvl|NewCustomerControllerExt.__sfdc_showDups() 13:34:08.889 (1889168000)|SYSTEM_METHOD_ENTRY|[150]|LIST.size() 13:34:08.889 (1889186000)|SYSTEM_METHOD_EXIT|[150]|LIST.size() 13:34:08.889 (1889240000)|SYSTEM_METHOD_ENTRY|[151]|String.valueOf(Object) 13:34:08.889 (1889260000)|SYSTEM_METHOD_EXIT|[151]|String.valueOf(Object) 13:34:08.889 (1889287000)|SYSTEM_METHOD_ENTRY|[154]|System.debug(ANY) 13:34:08.889 (1889300000)|USER_DEBUG|[154]|DEBUG|****************DupeValue 21---001W00000056A4iIAE 13:34:08.889 (1889306000)|SYSTEM_METHOD_EXIT|[154]|System.debug(ANY) 13:34:08.889 (1889329000)|SYSTEM_METHOD_ENTRY|[155]|String.valueOf(Object) 13:34:08.889 (1889345000)|SYSTEM_METHOD_EXIT|[155]|String.valueOf(Object) 13:34:08.889 (1889355000)|SYSTEM_METHOD_ENTRY|[155]|System.debug(ANY) 13:34:08.889 (1889360000)|USER_DEBUG|[155]|DEBUG|****************DupeValue 22---001W00000056A4iIAE
Usually if you cast something as an "Id" rather than as a String, apex is smart enough to do the converstion between 18 and 15 characters for you.
Try saving the 18 length id to an "Id" object and see how that works.