Set Default Value 1 to Duration Field
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 @15477041=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, @2460289))"
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 @621872='' or @start<=@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>

Thanks,
Sofiane
