Download Video Tutorial of How to Enable logs for Siebel Dedicated Client | Next Tip »?

Recent Posts

Recent Comment


Calculated Field and Set Field Value.

By neel | April 15, 2008

Following up with my Previous Post I am back with an example of SetFieldValue on a calculated field.

In Action BC there is a Field called Primary Owned by Full Name.
The calculated value of this field is [Owner First Name]+” “+[Owner Last Name]
Picklist defined on that field is PickList Owned By.

In the screenshot below you can see the Configuration of the field and the pickmap defined on that field

Calculated Field Configuration

Calculated field picklist and configuration

Calculated Field PickMap

Siebel Calculated field and pickmap

If I execute the following script. 

var ActionBO = TheApplication().GetBusObject(“Action”);
var ActionBC = ActionBO.GetBusComp (“Action”);

with ( ActionBC )
{
    ClearToQuery ();
    SetViewMode (3);
    SetSearchSpec (“Id”, ActionId);
    ExecuteQuery (ForwardOnly);

   if (FirstRecord())
      {
              // No need to activate field as Calculated fields are always active
                SetFieldValue (“Primary Owned by Full Name”, “Neelmani Gautam”);
       }
}

This script will result in contact with First name as Neelmani and Last Name as Gautam to be picked and assigned and the pick map define will populate other fields based on the contact that has been picked.

I Hope that clears any doubt that you might have had.


OkAvarageGoodVery GoodExcellent (1 votes, average: 3 out of 5)
Loading ... Loading ...

Related Posts

Categories: Configuration |

6 Responses to “Calculated Field and Set Field Value.”

  1. Radha MonsterID Icon Radha Says:
    April 16th, 2008 at 11:20 am

    Is it not to going to error out if I say ‘Write Record’ after this statement
    if (FirstRecord())
    {
    SetFieldValue (“Primary Owned by Full
    Name”, “Neelmani Gautam”);
    }

    Because we cannot write the data from Calculated Fields to the database

  2. neel MonsterID Icon neel Says:
    April 16th, 2008 at 10:24 pm
    That is what I am trying to explain here… that once we provide a pick map and picklist to a calculated field it starts acting as a pickapplet.

    So when I say setfieldvalue it is similar to saying “Pick” in a pickapplet and it populates the the fields in pick map with the appropirate values.

    I think the best thing to do is try yourself and see what happens.. that will help you to understand it better

  3. Praveen Reddy V MonsterID Icon Praveen Reddy V Says:
    May 1st, 2008 at 10:23 am

    A calculated field is editable if it has a picklist and a pickmap defined or it the Calculate value is left blank. This is got nothing specific to scripting this is the way the siebel business components behave. Create a Calculated Field with a picklist and a pickmap or simply with a blank calculated value and expose it in the UI and you would it editable and not grayed out the way typical calculated fields behave. You can enter values into the field or pick a record and save the record the value would remain as it is run. Now refresh the applet and the value would disappear. So basically what is happening here is siebel is writing the value to the active instance of the buscomp and once refreshed it is cleaned up. Since a Calculated Field is not mapped to any database column Siebel would never even try to accomodate a field change on Calculated Field into a sql insert or update. The same thing happens in scripting. This proves a basic point understand siebel through configuration and then apply it to scripting.

  4. neel MonsterID Icon neel Says:
    May 1st, 2008 at 9:46 pm
    good explaination praveen,

    But if you see again the screen shots I had pasted it doesn’t contain an empty value. it contains a calculated expression that is concatenation of first name and last name. this field is read only on UI … I didn’t create this field but it works fine and it does show that correct value in the on UI too.. so I think your explaination is incomplete.

  5. Praveen Reddy V MonsterID Icon Praveen Reddy V Says:
    May 2nd, 2008 at 12:44 am

    Please read this statement i had written again

    Create a Calculated Field with a picklist and a pickmap or simply with a blank calculated value and expose it in the UI and you would it editable and not grayed out the way typical calculated fields behave.

    It doesnt say that the calculated value should be blank if there is a picklist and a pickmap associated with it.

    I combined the two scenarios so maybe thats little confusing.

    Best thing is to put two calculated fields on UI and see it out.
    One with a blank calculate value
    Another with a calculated value and Picklist associated to it along with a pickmap.

  6. Srinivas MonsterID Icon Srinivas Says:
    June 30th, 2008 at 5:44 am

    Hi,

    If Pickmap is used for a calculated field it will become editable but the final result of the field value will be based on calculated value not based on pickmap. We can find this behaviour once you refresh record. There will be some dummy vanilla calculated fields which are used to calculate based on C++ code which will run in the backend

Comments