You need to sign in to do that
Don't have an account?
balakrishna mandula 19
SF2SF Integration with attachments
Hi,
I implemented S2S Integration using WSDLs. I am trying to insert Task with attachment in Org1, and in Org2, Task with attachment should get copied. I am now able to get Task record and related attachment in Org2. But the attachment is not coming proper type. Type of attachment is differing from Org1.
Source(Org1):
Attachment[] attachmnt =[SELECT Id,Name From Attachment where Parentid=: tsk[0].id];
System.debug('Attachment of Task' +attachmnt);
String s1 = String.valueOf(attachmnt);
System.debug('Attachment in String of Task' +s1);
Blob b = EncodingUtil.base64Decode(s1);
String KeyString = b.toString();
Con_Partner_Cls_GSFD_2.Soap obj1 = new Con_Partner_Cls_GSFD_2.Soap();
Con_Partner_Cls_GSFD_2.LoginResult lr = obj1.login('balakrishna.mandula@accenture.global.gsfd', 'Denny123$mvgFOkhVwqZF1G2cQ91KPdA11');
//Calling Partner class
ABInBev_EU_TaskClass_GSFD1.ABInBev_Global_TaskCls obj = new ABInBev_EU_TaskClass_GSFD1.ABInBev_Global_TaskCls();
obj.SessionHeader = new ABInBev_EU_TaskClass_GSFD1.SessionHeader_element();
obj.sessionHeader.sessionid = lr.sessionId;
for(BMCServiceDesk__Task__c task : tsk){
obj.insertTask(status, KeyString);
break;
}
Org2:
webService static void insertTask(String status, String s1){
Task__c tsk = new Task__c();
tsk.Status_to_Map__c = status;
try{
insert tsk;
}
catch(Exception e){
System.debug('Exception ' +e);
}
Blob b = blob.valueOf(s1);
String KeyString = EncodingUtil.base64Encode(Blob.valueOf(s1));
Attachment attach = new Attachment();
attach.parentId = tsk.id;
attach.name = 'Holidays List';
attach.body = b;
insert attach;
Attachement is getting inserted with Name "Holidays List" but with not correct format.
Note: I can only pass String type for attachment thru method in Org1.
Please help me to resolve this issue
thanks in advance
I implemented S2S Integration using WSDLs. I am trying to insert Task with attachment in Org1, and in Org2, Task with attachment should get copied. I am now able to get Task record and related attachment in Org2. But the attachment is not coming proper type. Type of attachment is differing from Org1.
Source(Org1):
Attachment[] attachmnt =[SELECT Id,Name From Attachment where Parentid=: tsk[0].id];
System.debug('Attachment of Task' +attachmnt);
String s1 = String.valueOf(attachmnt);
System.debug('Attachment in String of Task' +s1);
Blob b = EncodingUtil.base64Decode(s1);
String KeyString = b.toString();
Con_Partner_Cls_GSFD_2.Soap obj1 = new Con_Partner_Cls_GSFD_2.Soap();
Con_Partner_Cls_GSFD_2.LoginResult lr = obj1.login('balakrishna.mandula@accenture.global.gsfd', 'Denny123$mvgFOkhVwqZF1G2cQ91KPdA11');
//Calling Partner class
ABInBev_EU_TaskClass_GSFD1.ABInBev_Global_TaskCls obj = new ABInBev_EU_TaskClass_GSFD1.ABInBev_Global_TaskCls();
obj.SessionHeader = new ABInBev_EU_TaskClass_GSFD1.SessionHeader_element();
obj.sessionHeader.sessionid = lr.sessionId;
for(BMCServiceDesk__Task__c task : tsk){
obj.insertTask(status, KeyString);
break;
}
Org2:
webService static void insertTask(String status, String s1){
Task__c tsk = new Task__c();
tsk.Status_to_Map__c = status;
try{
insert tsk;
}
catch(Exception e){
System.debug('Exception ' +e);
}
Blob b = blob.valueOf(s1);
String KeyString = EncodingUtil.base64Encode(Blob.valueOf(s1));
Attachment attach = new Attachment();
attach.parentId = tsk.id;
attach.name = 'Holidays List';
attach.body = b;
insert attach;
Attachement is getting inserted with Name "Holidays List" but with not correct format.
Note: I can only pass String type for attachment thru method in Org1.
Please help me to resolve this issue
thanks in advance