Bookshelf Home | Contents | Index | PDF |
Configuring Siebel Open UI > Reference Information for Siebel Open UI > Notifications That Siebel Open UI Supports > Example Usages of NotificationsThis topic describes example usages of notifications. The following code is an example usage of the NotifyBeginNotifys notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_DELETE_RECORD"), function (propSet){ // Change has occurred at server BC. Do something here: this.SetProperty ("Refresh_Renderer", true); The following code is an example usage of the NotifyNewSelection notification: this.AttachNotificationHandler(consts.get("SWE_PROP_NOTI_SELECTED"), function (propSet){ if (propSet.GetProperty(consts.get("SWE_PROP_NOTI_SELECTED")) === "false") this.SetProperty ("rowBeingUnselected", propSet.GetProperty("SWE_PROP_BC_NOTI_ACTIVE_ROW")); The following code is an example usage of the NotifyNewFieldData notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_NEW_DATA_WS"), function (propSet){ var field = propset.GetProperty(consts.get("SWE_PROP_NOTI_FIELD")); if (field === "Customer Last Name"){ // Notify my extension that shows this value in a different way. this.SetProperty ("RefreshExtn", true); The following code is an example usage of the NotifyNewDataWorkset notification: // Trap an incoming change to the field value to do some flagging. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_NEW_DATA_WS"), function (propSet){ var field = propset.GetProperty(consts.get("SWE_PROP_NOTI_FIELD")); if (field === "Discount Percentage"){ var childPS = propSet.GetChildByType (consts.get("SWE_PROP_FIELD_VALUES")); CCFMiscUtil_StringToArray (fieldSet.GetProperty(consts.get("SWE_PROP_VALUE_ARRAY")), value); // Greater than 20% discount? Something fishy! this.SetProperty ("flagCustomer", true); The following code is an example usage of the NotifyNewData, NotifyInsertWorkSet, and NotifyDeleteRecordSet notifications: // First let's check if there's any change to the client workset. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_NEW_DATA"), function (){ this.SetProperty ("primeRenderer", true); // Now let's say our business is with the 4th record. We want to track if this record is replaced. // First we see if this 4th record is being deleted. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_DELETE_WORKSET"), function (propSet){ if (propSet.GetProperty("index" === 3){// 3 because count starts at 0 if (propSet.GetProperty("nr") === 1 || propSet.GetProperty("NumRows") === 1){ if (this.Get("primeRenderer")){ this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_INSERT_WORKSET"), function (propSet){ var underReplacement = this.GetProperty ("deleted"); if (this.Get("primeRenderer") && propSet.GetProperty("index") === this.GetProperty("deleted")){ // All conditions met. Now we'll get some info from what is being added. var childPS = propSet.GetChildByType (consts.get("SWE_FIELD_VALUE_STR")); CCFMiscUtil_StringToArray (childPS.GetProperty(consts.get("SWE_PROP_VALUE_ARRAY")), fieldArray); this.SetProperty ("New_Name_Value", fieldArray[2]); this.SetProperty ("primeRenderer", false); The following code is an example usage of the NotifyBeginQuery, NotifyNewFieldQuerySpec, and NotifyEndQuery notifications: // Let's see a simple example involving all the three. First we will take up the query start. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_BEGIN_QUERY"), function (){ // Query begins - The renderer will use this notification to show a bubble box having a number of choices. This might be driven off of a dropdown in the actual applet - we already have the choices. this.SetProperty ("showBubble", true); // Now we'll attach to Field Spec. If that dropdown has a pre default value, then we can highlight that choice in our bubble. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_NEW_FIELD_QUERYSPEC"), function (propSet){ if (propSet.GetProperty(consts.get("SWE_PROP_NOTI_FIELD") === "Customer Type"){ var value = propSet.GetProperty(consts.get("SWE_PROP_VALUE"); var bubbleValues = this.Get (bubbleValueArray); this.SetProperty ("SetBubbleHighlightIndex", bubbleValues.indexOf(value)); // Next the obvious. The death of the bubble. this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_END_QUERY"), function (){ this.SetProperty ("showBubble", false); The following code is an example usage of the NotifyEndNotifys notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_END"), function (){ // No more notifications. Mark for UI Refresh. this.SetProperty ("refreshUI", true); The following code is an example usage of the SWEIRowSelection notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_GENERIC"), function (propSet){ var type = propSet.GetProperty(consts.get("SWE_PROP_NOTI_TYPE")); if (type === "SWEIRowSelection"){ CCFMiscUtil_StringToArray (propSet.GetProperty(consts.get("SWE_PROP_ARGS_ARRAY"), argsArray); this.SetProperty ("SixthRowSelected", true); The following code is an example usage of the BegRow notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_GENERIC"), function (propSet){| var type = propSet.GetProperty(consts.get("SWE_PROP_NOTI_TYPE")); CCFMiscUtil_StringToArray (propSet.GetProperty(consts.get("SWE_PROP_ARGS_ARRAY"), argsArray); this.SetProperty ("beginRow", parseInt(argsArray[1])); The following code is an example usage of the GetQuickPickInfo notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_GENERIC"), function (propSet){ var type = propSet.GetProperty(consts.get("SWE_PROP_NOTI_TYPE")); if (type === "GetQuickPickInfo"){ (propSet.GetProperty(consts.get("SWE_PROP_ARGS_ARRAY")), argsArray); if (argsArray[5] === "MyValue"){ // The dropdown contains a value that we don't like.. this.SetProperty ("disablePick", true); The following code is an example usage of the ClosePopup notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_GENERIC"), function (propSet){ var type = propSet.GetProperty(consts.get("SWE_PROP_NOTI_TYPE")); // The below is just an example. PM's should not alert anything. Leave that to the PRs. alert ("Make sure you have collected all details. You next operation will save the record!"); The following code is an example usage of the SWEAInvokeMethod notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_GENERIC"), function (propSet){ var type = propSet.GetProperty(consts.get("SWE_PROP_NOTI_TYPE")); if (type === "SWEAInvokeMethod"){ if (argsArray[1] === "NewRecord"){ // Ah so there's going to be a new record that has happened as a chain. // Let's set a property so that we can do an AddMethod on this NewRecord, // and extend it to our liking this.SetProperty ("isChained", true); The following code is an example usage of the NotifyStateChanged notification: this.AttachNotificationHandler(consts.get("SWE_PROP_BC_NOTI_STATE_CHANGED"), function (propSet){ var type = propSet.GetProperty("type"); var value = propSet.GetProperty("value"); // This is just an example. Switch-case is preferred if multiple types need to if (type === "cr" || type === "CurRowNum"){ // Current Row has changed at the server. if (value === this.Get("MyPreviouslyStoredActiveRow")){ // Or not! What's going on. Something wrong with my logic? if (type === "nr" || type === "NumRows"){ // Woah, this user seems to be going through a lot of records! // Shouldn't she be using the query function? |
Configuring Siebel Open UI | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |