COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => SDK => Topic started by: meleskim on 25 Apr 2012 04:10:25 PM

Title: Cognos SDK Create Schedule and then add Email Delivery and set Prompt Value
Post by: meleskim on 25 Apr 2012 04:10:25 PM
Hi,

I have downloaded the below SDK example:

SDK sample to schedule a report to run and create a report view.
http://www-01.ibm.com/support/docview.wss?uid=swg21367562

I can run the example against our cognos server successfully to create a schedule, but instead of creating a report view, I would like the delivery of the report to be sent
to email recipients using the SDK.

If I go into the schedule page of the report using the Cognos Web Interface, I can set this information:
i.e.:
"Send a link to the report by email"
I can then configure the email recipients, set whether the report attachments and/or links should be set out with the email, the body
of the email and the subject.
I would also like to use the SDK to set the Prompt Values for report.
(see attached file -> SetEmailAndPromptValues.jpg)

Therefore:
Could anybody point me in the right direction using the SDK to:
Create a schedule with delivery email information set and override the default report prompt values.

Again the SDK sample that I have noted above works, but I cannot figure out what runoptions to use and the format of the runoptions
to properly set the email and override prompt info.

Thanks,

Matt
Title: Re: Cognos SDK Create Schedule and then add Email Delivery and set Prompt Value
Post by: murali999 on 25 Jun 2012 03:28:18 AM
Hi Matt,
You can use the RunOptionBoolean to set the email Delivery , try the below code it should work


OptionArrayProp oap = new OptionArrayProp();
Option opt[]=new Option[4];

//To set the email option to true
RunOptionBoolean email=new RunOptionBoolean();
email.setName("email");
email.setValue("true");

//To set the email as attachment to true
RunOptionBoolean emailattach=new RunOptionBoolean();
emailattach.setName("emailAsAttachment");
emailattach.setValue("true");

//To set the email as URL/Link to true
RunOptionBoolean emailurl=new RunOptionBoolean();
emailurl.setName("emailAsURL");
emailurl.setValue("true");


//To set the Email Addresses
DeliveryOptionAddressSMTPArray smtpArray=new DeliveryOptionAddressSMTPArray();
smtpArray.setName(DeliveryOptionEnum.toAddress); // To set the ToAddress

AddressSMTP emailAddresses[] = new AddressSMTP[2];
AddressSMTP emailAddress1 = new AddressSMTP();
emailAddress1.setValue("testemail@company.com");
emailAddresses[0]=emailAddress1;
AddressSMTP emailAddress2 = new AddressSMTP();
emailAddress2.setValue("testemail2@company.com");
emailAddresses[1]=emailAddress2;

smtpArray.setValue(emailAddresses); // To set the delivery Option Array

opt[0].setValu(email)
opt[1].setValue(emailattach);
opt[2].setValue(emailurl);
opt[3].setValue(smtpArray);

oap.setValu(opt); // to set the options array prop

schede.setOptions(oap); // here schedule is Schedule object


// The above code will set the email option with attachment and url link to report and
//add the 2 email adresses to toAddress

Regards,
Murali[/b]

RA:
Removed the red color and placed coding between correct tags