Skip to main content

Posts

Showing posts from August, 2021

Find record query loop in Siebel eScript

  var EngBO, EngBC, EngId, RecordCount, withRecord, UserName, UserId; EngBO = TheApplication().GetBusObject("My Business Object"); EngBC = EngBO.GetBusComp("My Business Component");          with (EngBC)     {         ActivateField("Parent Id");         SetViewMode(AllView);         ClearToQuery();         SetSearchSpec ("Parent Id", ServiceId);         ExecuteQuery(ForwardOnly);         RecordCount = CountRecords();         withRecord = FirstRecord();                  while(withRecord)         {             EngId = GetFieldValue("Id");             UserNa...

Insert record through Siebel eScript

Insert Record through Siebel eScript var TBO, TBC; TBO = TheApplication().GetBusObject("My Business Object"); TBC = TBO.GetBusComp("My Business Componenet");     with(TBC)     {         NewRecord(NewAfter);         SetFieldValue("End Time",TE);         SetFieldValue("Start Time",TS);         SetFieldValue("Status","Active");         SetFieldValue("User Id",UserId);         SetFieldValue("Parent Id",EngId);         SetFieldValue("Date","08/10/2021");                     WriteRecord();     }

How to get desired characters from a String in Siebel eScirpt

substring() Method Extract desired characters from a String (Length Fixed) var SHRs, SMins, TimeStart = "10:30"; SHRs = TimeStart.substring(0,2); //0: Start, 2: End not included SMins = TimeStart.substring(3,5); Results: SHRs: 10 SMins: 30 -- -- -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- -- -- -- Syntax stringVar.substring(start[, end]) start: An integer specifying the location of the beginning of the substring to be returned end: An integer one greater than the location of the last character of the substring to be returned Returns A new string, of length end - start, containing the characters that appeared in the positions from start to end - 1 of stringVar. Usage This method returns a portion of stringVar, comprising the characters in stringVar at the positions start through end - 1. The character at the end position is not included in the returned string. If the end parameter is not used, stringVar.substring() returns the characters fr...

How to get Day name from date in Siebel eScript

Below function in Siebel eScipt will return the Day from the date. Input: CurrentDate: 08/10/2021 (MM/DD/YYYY) Result: Tuesday var dayName, CurrentDate; dayName = GetWeekDay(CurrentDate);  -- -- GetWeekDay -- -- function GetWeekDay(currentDate) {     var weekDay, sDate, theYear, sDay = "", i = 0;     weekDay = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");     sDate = new Date(currentDate);     theYear = sDate.getFullYear()          while (i < sDate.getDay())     {         i++;         sDay = weekDay[i];     }     return(sDay); }

How to get today date in MM DD YYYY format in Siebel eScript

Below is eScript which will get the today's date: var CurrentDate, DateStart, MM, DD, YYYY; if (DateStart == "")         {             CurrentDate = new Date;             //above line will get the date in "Tue Aug 10 2021 13:30:45" format.             DD = CurrentDate.getDate();             MM = (CurrentDate.getMonth() + 1);             YYYY = CurrentDate.getFullYear();             DateStart = ToNumber(MM) + "/" + ToNumber(DD) + "/" + ToNumber(YYYY);         }

How to get today date for next year in MM DD YYYY format in Siebel eScript

Below sScript will help to get today's date with next year. Today: 08/10/2021 Result: 08/10/2022 var  CurrentDate, DateEnd, DD, MM, YYYY;  if (DateEnd == "")         {             //Next Year Date                CurrentDate = new Date;                //Tue Aug 10 2021 13:30:45             DD  = CurrentDate.getDate();             MM = (CurrentDate.getMonth() + 1);             YYYY = (CurrentDate.getFullYear() + 1);             DateEnd = ToNumber(MM) + "/" + ToNumber(DD) + "/" + ToNumber(YYYY);             //Outputs.SetProperty("OutTest",DateEnd);         }...

How to get Date difference in Days Siebel eScript

  Date input: MM/DD/YYYY format. Function will return date difference in Days. Inputs: DateStart: 08/10/2021 DateEnd: 08/11/2021 Result: DaysCount : 2   var DaysCount, DateStart, DateEnd; DaysCount = getDateDiff(DateStart, DateEnd);  -- -- -- getDateDiff -- -- -- function getDateDiff(DateStart, DateEnd) {     DateEnd  = new Date(DateEnd);     DateStart  = new Date(DateStart);     var diffDays = (DateEnd - DateStart)/(1000*60*60*24);     diffDays = ToNumber(diffDays)+1;     return(diffDays) }

Applet Search Spec not working on Status field of S_EVT_ACT

Issue: Below applet search spec is not working. On UI all Approved records are also showing. [Primary Owner Id] = LoginId() AND [Status] <> LookupValue("EVENT_STATUS", "Approved")  Analysis: For Logs found that Siebel is not picking the correct Status column of S_EVT_ACT table. Actual column is S_EVT_ACT .EVT_STAT_CD for status field. Siebel is picking wrong column from wrong table: S_ACT_EMP .ACT_EVT_STAT_CD Query part from logs: T1.EMP_ID = :2 AND T33.ROW_ID = T1.ACTIVITY_ID AND T1.EMP_ID = T21.ROW_ID AND T33.TARGET_PER_ID = T29.ROW_ID (+) AND T33.TARGET_PER_ID = T7.PAR_ROW_ID (+) AND T33.PR_PRDINT_ID = T27.ROW_ID (+) AND T27.PRDINT_ID = T23.ROW_ID (+) AND T33.TARGET_OU_ADDR_ID = T19.ROW_ID (+) AND ( (T33.OWNER_PER_ID = :3 AND T1.ACT_EVT_STAT_CD NOT IN ( :4 ) ) AND (T33.X_ENTITY_TYPE = 'Research') AND (T33.CREATED >= TO_DATE(:6,'MM/DD/YYYY HH24:MI:SS'))) ORDER BY T33.CREATED DESC Work around: Create a calculated field in Business Componen...