Siebel performance for script <1>

Source: Internet
Author: User

1. Code in pregetfieldvalue, presetfieldvalue, setfieldvalue, precaninvokemethod, preinvokemethod and invokemethod event handlers has been placed outside the switch on fieldname/methodname.

Wrong example: by DW

function BusComp_SetFieldValue (FieldName){. . . . .var boQuote = TheApplication().ActiveBusObject();var bcQuote = boQuote.GetBusComp("Quote");var nExchangeRate = bcQuote.GetFieldValue("Display Exchange Rate");var sCRMCurrencyCode = bcQuote.GetFieldValue("Currency Code");var nCommission = 0,nCRMCommission = 0,nCommmissionRate = 0;var nBudgetConRate =this.GetFieldValue("Conversion Rate");var nQuoteTotal = this.GetFieldValue("Quote Total");var sCurrencyCode = this.GetFieldValue("Currency Code");if(FieldName == "Commission"){. . . . . .    }

Consequence

These event handlers have meaning if related to a participant fieldname or methodname passed as input by the infrastructure.

Code places outside the switches on such variables will be executed for every field or method. This means that it will be unnecessarily executed a lot of times

For example this is the list of methods invoked to displayContact List Applet:

PreCanInvokeMethod invoked DeleteRecordPreCanInvokeMethod invoked ShowQueryAssistantPreCanInvokeMethod invoked ToggleListRowCountPreCanInvokeMethod invoked UndoQueryPreCanInvokeMethod invoked ExecuteQueryPreCanInvokeMethod invoked GotoNextSetPreCanInvokeMethod invoked GotoPreviousSetPreCanInvokeMethod invoked NewQueryPreCanInvokeMethod invoked NewRecordPreCanInvokeMethod invoked PositionOnRowPreCanInvokeMethod invoked UndoQueryPreCanInvokeMethod invoked UndoRecordPreCanInvokeMethod invoked WriteRecordPreCanInvokeMethod invoked ShowPopupPreCanInvokeMethod invoked ToggleLayoutPreCanInvokeMethod invoked GetBookmarkURLPreCanInvokeMethod invoked FileSendMailPreCanInvokeMethod invoked FileSendFaxPreCanInvokeMethod invoked FileSendPagePreCanInvokeMethod invoked FileSendWirelessPreCanInvokeMethod invoked ImportPreCanInvokeMethod invoked ExportQueryPreCanInvokeMethod invoked CopyRecordPreCanInvokeMethod invoked ChangeRecordsPreCanInvokeMethod invoked MergeRecordsPreCanInvokeMethod invoked SelectAllPreCanInvokeMethod invoked InvertSelectionPreCanInvokeMethod invoked ColumnsDisplayedPreCanInvokeMethod invoked GotoPreviousPreCanInvokeMethod invoked GotoNextPreCanInvokeMethod invoked GotoFirstSetPreCanInvokeMethod invoked GotoLastSetPreCanInvokeMethod invoked RefineQueryPreCanInvokeMethod invoked AboutRecordPreCanInvokeMethod invoked EditPopupPreCanInvokeMethod invoked ExecuteReplyPreCanInvokeMethod invoked ExecuteReplyAllPreCanInvokeMethod invoked ExecuteForwardPreCanInvokeMethod invoked EmailSendPreCanInvokeMethod invoked EmailCancelPreCanInvokeMethod invoked RecordCountPreCanInvokeMethod invoked AddToSyncListPreCanInvokeMethod invoked RemoveFromSyncListPreCanInvokeMethod invoked SynchContactPreCanInvokeMethod invoked NewOrderPreCanInvokeMethod invoked NewQuotePreCanInvokeMethod invoked SortOrderPreCanInvokeMethod invoked GotoApplet

If an object allocation, a BC query, a callCountrecordsIs placed outside the switch, it will be executed unnecessarily more than 40 times only at applet load. This may result in a sub-optimal performance.

Solution

Place all the code in these Event Handlers inside the switch on method or field name.

Only variable Declaration (not allocation) shocould be places outside.

function BusComp_SetFieldValue (FieldName){. . . . .if(FieldName == "Commission"){var boQuote = TheApplication().ActiveBusObject();var bcQuote = boQuote.GetBusComp("Quote");var nExchangeRate = bcQuote.GetFieldValue("Display Exchange Rate");var sCRMCurrencyCode = bcQuote.GetFieldValue("Currency Code");var nCommission = 0,nCRMCommission = 0,nCommmissionRate = 0;var nBudgetConRate =this.GetFieldValue("Conversion Rate");var nQuoteTotal = this.GetFieldValue("Quote Total");var sCurrencyCode = this.GetFieldValue("Currency Code");. . . . . .    }

 

Siebel performance for script <1>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.