Add Personalized Response to Manual Notification

From SDU
Revision as of 05:38, 26 July 2008 by Gityerfix (Talk | contribs)

Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This article provides instructions on how to add Personalized Responses to a Manual Notification. Surprisingly, Manual Notifications are one Activity that does not utilize Personalized Responses. The code that follows provides an option for appending the field content (which is the standard systemwide behavior) or replacing the field content.

Note: This customization is only valid for r11.x releases.

Procedures

Step 1. Edit the nf.htmpl form

Add the following code to the HEAD of the form: <source lang="javascript"><SCRIPT LANGUAGE="JavaScript"> var resp_sym = new Array(); var resp_ids = new Array(); resp_sym[0] = ""; resp_ids[0] = ""; resp_field="KEEP.msgtxt"; resp_persid='$args.persistent_id'; resp_title="KEEP.msgtitle";

<PDM_IF "$prop.factory" == "chg"> var title_str = "Change order $args.chg_ref_num Manual Notify"; <PDM_ELIF "$prop.factory" == "iss"> var title_str = "Issue $args.ref_num Manual Notify"; <PDM_ELSE> <PDM_IF "$env.NX_OTB_MARKET" == "itil"> var title_str = "$args.type.sym $args.ref_num Manual Notify"; <PDM_ELSE> var title_str = "Request $args.ref_num Manual Notify"; </PDM_IF> </PDM_IF>

<PDM_IF "$args.type" == "R" || "$args.type" == ""> <PDM_LIST ESC_STYLE=JS2 prefix=list factory=response where="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND cr_flag=1"> resp_sym[resp_sym.length] = decodeURIComponent('$list.sym'); resp_ids[resp_ids.length] = '$list.id'; </PDM_LIST> <PDM_ELIF "$args.type" == "I"> <PDM_LIST ESC_STYLE=JS2 prefix=list factory=response where="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND in_flag=1"> resp_sym[resp_sym.length] = decodeURIComponent('$list.sym'); resp_ids[resp_ids.length] = '$list.id'; </PDM_LIST> <PDM_ELIF "$args.type" == "P"> <PDM_LIST ESC_STYLE=JS2 prefix=list factory=response where="delete_flag=0 AND (response_owner IS NULL or response_owner = U'$cst.id') AND pr_flag=1"> resp_sym[resp_sym.length] = decodeURIComponent('$list.sym'); resp_ids[resp_ids.length] = '$list.id'; </PDM_LIST> </PDM_IF>

function add_response_nf(i) { if(ahdframe.currentAction==0&&i>0) { var url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator()+ "+OP=PERSRESP_EXPAND+MSG_ID="+resp_ids[i]+ "+PERSID="+resp_persid+ "+CALLBACK=parent.ahdframe.add_response_callback_nf"; display_new_page(url,ahdframeset.workframe); set_action_in_progress(ACTN_AUTOFILL); } } function add_response_callback_nf(msg){ set_action_in_progress(0); // Following if statement will set the Message Title if blank if (document.main_form.elements["KEEP.msgtxt"].value == "") {

document.main_form.elements[resp_title].value=unescape(title_str);

} document.main_form.elements[resp_field].value+=unescape(msg); // Use to append Message Text content // document.main_form.elements[resp_field].value=unescape(msg); // Use to replace Message Text content } </SCRIPT></source>

Add the following code to the BODY of the form: <source lang="javascript"> if (resp_ids.length > 1) { <PDM_MACRO NAME=dtlStartRow> detailRowHdr("Personalized Response",1,0); docWriteln('<TR><TD ALIGN=LEFT>'); _dtl.eventHandler = 'onBlur="add_response_nf(selectedIndex)"'; docWriteln('<SELECT' + detailNextID(true) + '>'); for (i = 0; i < resp_ids.length; i++) { docWrite('<OPTION VALUE="' + resp_ids[i] + '" '); docWriteln('>' + resp_sym[i] +'</OPTION>'); } docWriteln('</SELECT></TD></TR>'); } </source>

Step 2. Clear the web cache

Publish your changes via the Web Screen Painter. The process of publishing automatically initiates a pdm_webcache.