PreWrite Function on Action (Doc ID 526822.1)

Last updated on MAY 13, 2016

Applies to:

Siebel Tools - Version 7.7.2.6 SIA [18372] and later
Oracle Solaris on SPARC (64-bit)
Product Release: V7 (Enterprise)
Version: 7.7.2.6 [18372] Fin Svcs
Database: Oracle 9.2.0.6
Application Server OS: Sun Solaris 5.8
Database Server OS: Sun Solaris 5.8

This document was previously published as Siebel SR 38-3137663541.

””Checked for Relevance on "MAY-13-2015””

Symptoms

Hi
I wrote this code on the Action BC PreWriteRecord Function
The code is trying to update a date field on associated contacts to Activities

if ((this.GetFieldValue("Type") == "Meeting" && this.GetFieldValue("Status") == "Completed") || (this.GetFieldValue("Type") == "Outbound Call" && this.GetFieldValue("Status") == "Completed" && this.GetFieldValue("NYL Purpose") == "Sales Presentation"))
        {
            //this.InvokeMethod("SetAdminMode", "TRUE");
            var bcContactAssoc = this.GetMVGBusComp("Contact Last Name");
            //bcContactAssoc.ClearToQuery();
            //bcContactAssoc.SetViewMode(AllView);
            
            bcContactAssoc.ActivateField("Last Name");
            bcContactAssoc.ActivateField("NYL Rep Last Contacted Date");
            bcContactAssoc.InvokeMethod("SetAdminMode", "TRUE");
            bcContactAssoc.SetSearchSpec("Last Name", "*");
            bcContactAssoc.ExecuteQuery(ForwardOnly);
            var isContactRecord = bcContactAssoc.FirstRecord();
            while (isContactRecord)
            {
                  if (bcContactAssoc.GetFieldValue("NYL Rep Last Contacted Date") == "")
                {
                    bcContactAssoc.SetFieldValue("NYL Rep Last Contacted Date",this.GetFieldValue("Planned"));
                    bcContactAssoc.WriteRecord();
                }
                else if (bcContactAssoc.GetFieldValue("NYL Rep Last Contacted Date") < this.GetFieldValue("Planned"))
                {
                    bcContactAssoc.SetFieldValue("NYL Rep Last Contacted Date",this.GetFieldValue("Planned"));
                    bcContactAssoc.WriteRecord();
                }
                isContactRecord = bcContactAssoc.NextRecord();
            }
            bcContactAssoc = null;
        }

Code works fine if the activity is owned by the person who is loged in. but if the activity is owned by a different person it throughs the error message. i m attaching the screen shot of the error message. In error message u will see the field name 'NYL Rep Last Contacted Date'. Thats the field we trying to updat on contact BC. this field is not read only on BC
I m also attaching the sif file for Action and Contact BC's

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms