1 reply Latest Post - ‏2012-07-18T06:33:17Z by murali999
217 Posts

Pinned topic Cognos SDK Create Schedule and then add Email Delivery and set Prompt Value

‏2012-04-25T19:03:46Z |

I have downloaded the below SDK example:

SDK sample to schedule a report to run and create a report view.

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:
"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)
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.


Updated on 2012-07-18T06:33:17Z at 2012-07-18T06:33:17Z by murali999
  • murali999
    9 Posts

    Re: Cognos SDK Create Schedule and then add Email Delivery and set Prompt Value

    ‏2012-07-18T06:33:17Z  in response to SystemAdmin
    Hi Matt,

    You can use the RunOptionBoolean to set the email Delivery , try the below code it will 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(
    //To set the email as attachment to true RunOptionBoolean emailattach=
    new RunOptionBoolean(); emailattach.setName(
    "emailAsAttachment"); emailattach.setValue(
    //To set the email as URL/Link to true RunOptionBoolean emailurl=
    new RunOptionBoolean(); emailurl.setName(
    "emailAsURL"); emailurl.setValue(
    //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(
    ""); emailAddresses[0]=emailAddress1; AddressSMTP emailAddress2 = 
    new AddressSMTP(); emailAddress2.setValue(
    ""); 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