bus_facade_campaign_automationByDate


**Description :** Used in the management of date based automations within the platform.
**Default Methods** Please ensure you're familiar with... - [**Introduction to Beans**](/documentation/soap/gettingstarted/beans) - [**Requests and Responses**](/documentation/soap/gettingstarted/requests) - [**Anatomy of a session**](/documentation/soap/gettingstarted/session)
**Unique Methods** To call these methods use the following example structure...
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automationByDate
processName string  :   methodName  i.e. generateSpamReport
entityData  array   :   i.e. array('beanId'  => ID of the bean in the bean store)
processData array   :   i.e. array(null)
Name Parameters Description
createNewDateRule Entity Data : automationName, listId, beanId Call this to add a new rule item to the existing set and to return default values for the rule, including the ruleId (used for populating the automation rules)
removeDateRule Entity Data: beanId, ruleId Removes the ruleId rule from the set of rules the date automation entity bean has in the bean store

Example Process - Creating a Date Automation with a single rule

WSDL

Our WSDL defines our web service and where to locate our web service. In understanding these examples please familiarise yourself with the handleRequest (paintRequest / paintResponse)


Step 1 : Begin by searching for the list entity to apply the automation to and obtain the listId...

Example Request / Response
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_list
processName string  :   search
entityData  array   :   'listName' => "Master List"
processData array   :   null
paintResponse:
Result   array :
         'result'     => "success",
         'resultData' => array
                         'bus_search_campaign_list_' => "" 
                          ... => ...
                         'idData' =>  array
                                      'listId' => 123456

Step 2 : Next, create an empty date automation entity in the bean store and obtain a reference to this...

Example Request / Response:
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automationByDate
processName string  :   create
entityData  array   :   null
processData array   :   null
paintResponse:
Result   array :   
         'result'     => "success"
         'resultData' => array
                         'bus_entity_campaign_automationByDate' => array
                                                        ... => ...
                                                        ...  variables  ...
                                                        'beanId' => ID for new empty bean in bean store

Step 3 : Next, create a new date rule in the automation entity in the bean store and obtain a reference to this new rule block...

Example Request / Response:
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automationByDate
processName string  :   createNewDateRule
entityData  array   : 
            'automationName_base64' => "QW5uaXZlcnNhcnkgQXV0b21hdGlvbg=="
            'listId'  => ID of the list to associate with this automation
            'beanId'  => ID of the empty bean returned during the create
processData array :   null
paintResponse:
Result   array :   
         'result'     => "success"
         'resultData' => array :
                         'bus_entity_campaign_automationByDate_newRuleData'  => array : 
                                                                                            ... => ...
                                                                                            'ruleId' => ID for new empty rule 
                                                                                                            in the entity bean in 
                                                                                                            bean store

Step 4 : Next search for the email entity to use with the autmation rule and obtain the messageId...

Example Request / Response:
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_email
processName string  :   search
entityData  array   :  'messageName' => "Thank_you_Anniversary"
processData array   :   null
paintResponse:
Result   array:
         'result'      => "success"
         'resultData'  => array :
                          'bus_search_campaign_email_' => ""
                          ... => ...
                          'idData' => array :
                                      'emailId' => 123456

Step 5 : Next, update the automation entity bean with the date rule....

Example Request / Response:
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automationByDate
processName string  :   update
entityData  array   :   
            'beanId'  => ID of the bean in the bean store to update
            'dateRules' => array :
                           '_01234568' => array :
                                          'ruleId'            => "_01234568"
                                          'startTime'         => Time to start the automation
                                          'customFieldName'   => List field to check for the rule
                                          'frequencyPeriod'   => How often to trigger the automation
                                          'frequencyType'     => Type of frequency for the condition 
                                                                  i.e. ANNUALLY or BEFORE_AFTER specific PERIOD
                                          'frequencyRelation' => BEFORE or AFTER
                                          'frequencyQuantity' => AMOUNT of time AFTER or BEFORE the time in PERIOD
                                                                 if TYPE = BEFORE_AFTER
                                          'messageId'         => Id of the message searched for in step 4
processData array :   null
paintResponse:
Result   array : 'result' => "success"

Step 6: Next complete a store request with the bean id of the new entity in the bean store to write this back to the platform and remove the bean from the bean store...

Example Request / Response
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automationByDate
processName string  :   store
entityData  array   :   'beanId'  => ID of the newly created, updated entity bean in the bean store
processData array   :   null
paintResponse:
Result   array :
         'result'     => "success"
         'resultData' => array
                         'bus_entity_campaign_automationByDate_key' => array : 
                                                                    'automationId' => 9987

step 7: Finally use the automation Id returned from the store request and the overall automation facade to toggle the status to ACTIVE

Example Request / Response:
paintRequest:
contextId   string  :   C-KFDsCMMHXpDUi0ltN0p3FvF
className   string  :   bus_facade_campaign_automation
processName string  :   toggleStatus
entityData  array   :   null
processData array   :   'automationId'  => ID of the newly created, updated entity 
paintResponse:
Result   array : 'result' => "success"

bus_entity_campaign_automationByDate

Writeable Variables : CREATE (Required)

Name Example Description
automationName_base64
"VEVTVA=="
The recommended way to transfer string data is via base64 encoding. The unique name for this automation base 64 encoded.
automationName
"TEST"
If there is no way to base64 encode the string, then you can use this variable as the unique name for this automation.
listId
75942
Identifier of the list selected that the date automation is going to be linked to

Writeable Variables : STORE / UPDATE (Required)

Name Example Description
dateRules
array(
  "_123456"=> array(
    'ruleId'=> "_123456",
    'startTime'=> "10:00",
    'customFieldName'=> "__DATE_OF_SIGNUP__"
    'frequencyPeriod'=> "DAY"
    'frequencyType'=> "BEFORE_AFTER"
    'frequencyRelation'=> "AFTER"
    'frequencyQuantity'=> "7"
    'filters'=> See Filter Facade 
    'messageId'=> 989787 ))
An array of the rules that are applied to this automation. The rule ID is given by performing the unique method createNewDateRule. Each id produced is the key for each array within this array, and each of the sub arrays is made up of the above.customFieldName is a CONSTANT made up of the reserved usable fields : __LAST_CLICKED_DATE__, __LAST_OPENED_DATE__, and field#name, where the # represents the custom field position and assumes that field is configured as a DATE field.The frequencyPeriod is either ON a specific date, ANNUALLY on a specific date, or a period BEFORE_AFTER a specific date.frequencyRelation is either BEFORE or AFTER if the period is BEFORE_AFTER.

Read-Only Variables : CREATE / LOAD / RELOAD

Name Example Description
amendedBy
"test.sys"
Username of the user that uploaded or amended the email last, only populated in an existing email
amendedDtTm
"24/02/2014 14:07:00"
The date time of the last amendment to this email, only populated in an existing email
allLists
array(
  123456 => "Master List")
An associative array (map) of all valid lists on this profile
allEmails
array(
  65645 => "August Email")
An associative array (map) of all valid emails on this profile
allSms
array(
  65645 => "August Sms")
An associative array (map) of all valid sms's on this profile
automationId
78457
Unique identifier for this automation
automationStatus
"INACTIVE" or "ACTIVE"
Current status of the automation
automationType
"DATESIGNUP"
The type of automation
listName
"Master List"
The name of the list associated with this filteR
frequencyTypes
array(
  "ON"=>"on"
  "ANNUAL"=>"every year"
  "BEFORE"=>"before or after")
An associative array of all the frequency types availiable to the automation
frequencyPeriods
array(
  "DAY"=>"day(s)"
  "WEEK"=>"week(s)"
  "MONTH"=>"month(s)")
An associative array of all the frequency periods availiable to the automation
frequencyRelations
array(
  "BEFORE"=>"before"
  "AFTER"=>"after")
An associative array of all the frequency relations availiable to the automation
dateFields
array(
  "__DATE_OF_SIGN_UP"=>"[date of signup*]"
  "__LAST_OPENED_DATE__"=>"[last opened date]"
  "__LAST_CLICKED_DATE__"=>"[last clicked date]"
  "field2Name"=>"dob")
An associative array of all the dateFields availiable to the automation from the list