Wednesday, July 21, 2010

Sample Script2

The following example queries the Contact business component and retrieves the First Name and Last Name of the first contact found:
var ContactBO = TheApplication().GetBusObject("Contact");
var ContactBC = ContactBO.GetBusComp("Contact");
with (ContactBC)
{
ClearToQuery();
SetViewMode(AllView);
var fieldsPS = TheApplication().NewPropertySet();
var valuesPS = TheApplication().NewPropertySet();
fieldsPS. SetProperty("Last Name", "");
fieldsPS.SetProperty("First Name", "");
ActivateMultipleFields(fieldsPS);
ExecuteQuery();
if (FirstRecord())
{
GetMultipleFieldValues(fieldsPS, valuesPS);
var slName = valuesPS.GetProperty("Last Name");
var sfName = valuesPS.GetProperty("First Name");
}
}

2 comments:

  1. Hi CBS,

    Nice blog very helpful, i have a requirement on scripting can you help me?

    ReplyDelete
  2. on a pick list field we have enforced statemodel based on different values changes dynamically to diff values that is working fine. now we have a req like
    1)when user selects value1 it should display value2 and able to select value2.
    2) when user selects value2 it displays value3&value4 dynamically and able to select those aslo.
    3) now if user selects value2 from value1 it should allow selection and if user selects value2 from value3 it should not allow and raise some error.
    4) HERE the crucial is it should allow to select value2 from value1 not from value3
    how to achecive this thru scripting? pls help.

    ReplyDelete