Expand my Community achievements bar.

SOLVED

Set Default Value 1 to Duration Field

Avatar

Level 2

Hello, I'm new to Adobe campaign and need some help with an Input Form regarding a field to be defaulting to 1 instead of 0 (See xml form below). Any feedback on how to achieve the result of  Campaign Duration defaulting to 1 would be greatly appreciated.

 

XML CampaignForm:

 

<form _cs="New marketing campaign (nms)" colcount="2" created="2021-08-09 04:41:39.193Z"
createdBy-id="0" entity-schema="nms:operation" entitySchema="xtk:form" img="nms:operation-large.png"
label="New marketing campaign" lastModified="2022-10-31 13:28:51.967Z" md5="43F6E55E32DECABFD9D339BB30577FFF"
modifiedBy-id="6756910" name="newOperation" namespace="nms" noNewInstance="true"
nothingToSave="true" xpathsToLoad="@isModel" xtkschema="xtk:form">
<enter>
<set value="false" xpath="/ignored/@checkProcessId"/>
<if expr="HasPackage('nms:webAnalytics')">
<set value="true" xpath="/ignored/remarketing/@showForm"/>
</if>
</enter>
<container name="lib" type="visibleGroup" visibleIf="false">
<container colcount="2" colspan="2" name="general">
<input colspan="2" xpath="@label"/>
<input xpath="@nature"/>
<input xpath="@messageType"/>
<container type="visibleGroup" visibleIf="@isModel">
<input xpath="@type"/>
</container>
<container colspan="2" type="visibleGroup" visibleIf="(@isModel and [/tmp/@saveAsModel]=='')">
<input createMode="none" img="nms:program.png" label="Parent marketing program"
xpath="programProcess">
<sysFilter>
<condition expr="@model = 'nmsProgram'"/>
</sysFilter>
</input>
</container>
<container colspan="2" type="visibleGroup" visibleIf="@isModel=false and ([/tmp/@newFromModel]==true or [/tmp/@newFromMenu]==true or [/tmp/processId]==0 or [/tmp/@showFolder]=1)">
<input createMode="none" img="nms:program.png" label="Program" writeAccess="true"
xpath="program">
<sysFilter>
<condition expr="@isView = 0 and @model = 'nmsProgram'"/>
</sysFilter>
</input>
</container>
<container colspan="2" type="visibleGroup" visibleIf="[/tmp/@saveAsModel]==true or ([/tmp/@showFolder]=1 and @isModel)">
<input createMode="none" label="Program" setDefault="true" writeAccess="true"
xpath="program">
<sysFilter>
<condition expr="@model = 'nmsOperationModel'"/>
</sysFilter>
</input>
</container>
<container applicableIf="HasPackage('crm:webex')" colcount="2" colspan="2"
type="visibleGroup" visibleIf="EV(@nature, 'webinar')">
<input xpath="crm/webex/webExAccount">
<sysFilter>
<condition expr="@type=30 AND @Active=true"/>
</sysFilter>
</input>
<input xpath="crm/webex/@meetingKey"/>
<input form="crm:webExSelectWebinar" img="crm:webex/webex_16x16.png" label="Webinar selection wizard..."
nolabel="true" prebuildSubForm="false" type="subformLink"/>
</container>
<static colspan="2" img="xtk:scheduledtasks.png" label="Schedule" type="separator"/>
<container colcount="2" colspan="2" type="visibleGroup" visibleIf="@isModel=false or EV(@type, 'periodic')">
<input xpath="@start"/>
<input xpath="@end"/>
</container>
<container colspan="2" type="visibleGroup" visibleIf="@isModel and EV(@type, 'periodic')=false">
<input xpath="@duration"/>
</container>
<container ref="nms:operation:lib/remarketingParams"/>
<static colspan="2" label="Description of the campaign" type="separator"/>
<input colspan="2" nolabel="true" xpath="desc"/>
</container>
</container>
<container colspan="2" type="visibleGroup" visibleIf="@isModel=false and [/tmp/@newFromModel]=false">
<static img="nms:circle-one.png">Select a campaign template</static>
<input boldLineExpr="@builtIn = 1" choiceButton="true" createMode="none" defaultModelSearchExpr="Iif([@_instanceModelId]!=0 and [@_instanceModelId]!='', '@id=' + [@_instanceModelId], '@internalName=\'opEmpty\'')"
folderFilterChoice="@model IN ('nmsOperationModel', 'nmsOperation')" form="nms:operation"
fullLoad="true" img="nms:operation.png" label="Template" newFromModelOnChange="true"
noZoom="true" schema="nms:operation" selectionPath="/tmp/model" type="linkEdit"
xpath="/tmp/@model">
<sysFilter>
<condition expr="@type != 2"/>
<condition expr="@isModel = 1"/>
</sysFilter>
<orderBy>
<node expr="@builtIn" sortDesc="true"/>
<node expr="@label"/>
</orderBy>

<enter name="onChange">
<if expr="@isModel=false or EV(@type, 'periodic')">
<!-- force the current date -->
<set expr="ToDate(GetDate())" xpath="@start"/>
<set expr="iif (@duration=0 or @start='' , @start, DateAdd(@start, @duration))"
xpath="@end"/>
</if>

<if expr="[/tmp/processId]!='' and [/tmp/processId]!=0 and [/ignored/@checkProcessId]=false">
<!-- Need to check if selected folder is a program and not a plan -->
<set value="xtk:folder" xpath="/ignored/queryDef/@schema"/>
<set value="get" xpath="/ignored/queryDef/@operation"/>
<set value="@model" xpath="/ignored/queryDef/select/node/@expr"/>
<set expr="'@id='+[/tmp/processId]" xpath="/ignored/queryDef/where/condition/@expr"/>

<soapCall name="ExecuteQuery" service="xtk:queryDef">
<param exprIn="[/ignored/queryDef]" type="DOMDocument"/>
<param type="DOMDocument" xpathOut="/tmp/queryDef"/>
</soapCall>

<if expr="[/tmp/queryDef/@model]!='nmsProgram'">
<!-- reset to force to choice a program -->
<set value="0" xpath="/tmp/processId"/>
</if>

<set value="true" xpath="/ignored/@checkProcessId"/>
</if>
</enter>
</input>
</container>
<static colspan="2" img="nms:circle-two.png">Complete or change the campaign settings</static>
<container ref="nms:newOperation:lib/general"/>
<leave>
<check expr="[/tmp/model/key/@value]!=0 and [/tmp/model/key/@value]!=''">
<error>You must specify a campaign template.</error>
</check>

<check expr="@isModel or @start='' or @End='' or @start&lt;=@end">
<error>The end date is earlier than the start date.</error>
</check>

<!-- Create job from process folder, need to apply the same folder key -->
<if expr="[/tmp/processId]!=0 AND [/tmp/processId]!=''">
<set expr="[/tmp/processId]" xpath="@program-id"/>
<set value="0" xpath="@programProcess-id"/>
</if>

<check expr="[@program-id]!=0">
<error>You must specify the campaign program.</error>
</check>

<soapCall name="CreateOperationFromModel" service="nms:operation">
<param exprIn="." type="DOMElement"/>
</soapCall>

<setNotifySaved/>

<!-- Need to wake up workflow task in case of there are some task to notify -->
<if expr="HasPackage('nms:mrm')">
<soapCall name="WakeupTask" service="xtk:workflow">
<param exprIn="'taskMgt'" type="string"/>
<param exprIn="''" type="string"/>
<param exprIn="'scheduler'" type="string"/>
</soapCall>
</if>
<!-- Set the workflow and its parameters in the Web Analytics extAccount -->
<if expr="HasPackage('nms:webAnalytics') and EV(@nature, 'opNatureRemarketing')">
<if expr="[@webAnalyticsAccount-id] != 0 and [/ignored/@webAnalyticsSegment] != '' and [/ignored/webAnalyticsDlvTemplate] != 0">
<soapCall name="SetRemarketingParams" service="nms:extAccount">
<param exprIn="@id" type="int"/>
<param exprIn="[@webAnalyticsAccount-id]" type="int"/>
<param exprIn="[/ignored/@webAnalyticsSegment]" type="string"/>
<param exprIn="[/tmp/webAnalyticsDlvTemplate]" type="int"/>
<param type="string" xpathOut="/ignored/@newWorkflowName"/>
</soapCall>
<if expr="[/ignored/@newWorkflowName]!=''">
<msgBox translatedExpr="'The segment ' + [/ignored/@webAnalyticsSegment]+ ' is now being processed by workflow ' + [/ignored/@newWorkflowName] +'.'"/>
</if>
</if>
</if>
</leave>
</form>

 

CampaignForm.png

Thanks,
Sofiane

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Soph75,

You need to modify campaign duration in campaign template as well.

Navigate to /Resources/Templates/Campaign templates/

And modify Campaign Duration to 1 in the campaign template which you use [by default, New campaign (opEmpty)].

ParthaSarathy_0-1667899891931.png

After modifying the template, Create a new campaign and you can find the campaign duration defaulting to 1.

View solution in original post

5 Replies

Avatar

Level 7

Hi @Soph75 ,

 

The field 'Campaign Duration' is set via option "NmsOperation_Duration" (Admin>Platform>Options).
So, if you want to set any default value such as 1 day then you can go to this option and set the default value in seconds.

_Shubham_Goyal__0-1667280644643.png

_Shubham_Goyal__1-1667280655318.png

 

Br,

Shubham

Avatar

Level 2

Hi Shubham, Thanks for your reply and pointing out the "NmsOperation_Duration" option value setting to 1. After making the update to the option then tried to create a new campaign... the Campaign duration field is still defaulting to 0. Is there an extra step that I'm missing in the Input form or nms:operation schema? Thanks, Soph

 

 

Soph75_0-1667314982810.png

 

Avatar

Level 7

Hi @Soph75 ,

 

In your case you should check the declaration of @duration field in the Input of "nms:operation" (Admin>Configuration>Input forms) as when I try to show @duration field on my side I can see the correct default period as 5d.

_Shubham_Goyal__0-1667542138480.png

 

Also, if this NmsOperation_duration field does not work for you then you can also try to extend this nms:operation schema and introduce a new attribute for a custom_duration and modify the formula of calculation of end date w.r.t to this new duration field. I haven't tried this custom part on my side but I think it should be achievable.

 

Br,

Shubham 

 

Avatar

Correct answer by
Community Advisor

Hi @Soph75,

You need to modify campaign duration in campaign template as well.

Navigate to /Resources/Templates/Campaign templates/

And modify Campaign Duration to 1 in the campaign template which you use [by default, New campaign (opEmpty)].

ParthaSarathy_0-1667899891931.png

After modifying the template, Create a new campaign and you can find the campaign duration defaulting to 1.

Avatar

Level 2

Hi Pratha, 

 

The suggested solution above worked when updating the Campaign Templates. The campaign duration is now defaulting to 1 when creating new ones.

 

Thanks,
Soph