AnsweredAssumed Answered

Using Apex Drawloop API - Unable to create documents using DDP

Question asked by ppallepati on May 18, 2016

Hi Drawloop Support Team,

 

I have installed Drawloop Document Generation app from appexchange place. I've reached out to one of your AE and made sure my business edition/ outbound messaging is enabled for my org. I've created a ddp and a delivery option(recordtype:attach) using the app. I'm using the below code to grab the attachments from Account record, send delivery option for ddp and as well as ddp id  to drawloop using Loop.LoopMessage.Send();

 

Code snippet:

 

Id ddpLoopId = 'a0936000001A3kC';

Id ddpDeployId = 'a0736000004Ygep';

Id acctId = '00136000005P7u0';

Loop.loopMessage lm = new Loop.loopMessage();

List<Attachment> nas= [select id,name from Attachment where parentid=:acctId];

String attachIds='';

for(Attachment na :nas){

               attachIds = attachIds+na.id+'|';

}

Map<string, string> variables;

                if(attachIds.length()>1){

                    attachIds = attachIds.substring(0,attachIds.length()-1);

//Below ID is of the "Delivery Option" of DDP

                    variables = new Map<string, string> { 'deploy' => ddpDeployId ,'attachIds'=>attachIds };

                }

Loop.loopMessage.send(acctId, ddpLoopId , variables, 'ap1');

 

 

I'm running this code through anonymous block. The code is running successfully but I am unable to see any attachment created through the ddp on Account record.

 

Any help is highly appreciated.

 

Thanks,

Priyanka.

Outcomes