Quantcast
Viewing all articles
Browse latest Browse all 2504

Generic field multiple values

Topic by Rajat Singh

The piece of code below  adds just the last value in generic custom field. I can put the create inside for loop tp work through all the ContactID's, The thing I want to know is there a way to add all the ContactID in the data value of generic field and add all the ContactID in one create call. Help will be greatly appreciated :) Thanks...

 

privateGenericFieldcreateGenericField(stringName,ItemsChoiceTypeitemsChoiceType,objectValue)

{

GenericFieldgf =newGenericField();

gf.name = Name;

gf.DataValue =newDataValue();

gf.DataValue.ItemsElementName =newItemsChoiceType[] { itemsChoiceType };

gf.DataValue.Items =newobject[] { Value };

returngf;

}

publicvoidInsertCFLA()

{

try

{

ClientInfoHeaderclientInfoHeader =newClientInfoHeader();

clientInfoHeader.AppID ="Insert into CommonFix_LA Custom Object (This object is a landing area)";

GenericObjectgo =newGenericObject();

//Set the object type

RNObjectTypeobjType =newRNObjectType();

objType.Namespace ="LandingArea";

objType.TypeName ="CommonFix_LA";

go.ObjectType = objType;

for(inti = 250000; i <= 250020; i++)

{

stringContactID =Convert.ToString(i);

 

List<GenericField> gfs =newList<GenericField>();

 

gfs.Add(createGenericField("ContactID",ItemsChoiceType.StringValue, ContactID));

 

 

go.GenericFields = gfs.ToArray();

 

}

//go.GenericFields = gfs.ToArray<GenericField>();

CreateProcessingOptionscpo =newCreateProcessingOptions();

cpo.SuppressExternalEvents =false;

cpo.SuppressRules =false;

RNObject[] results = _client.Create(clientInfoHeader,newRNObject[] { go }, cpo);

}


Viewing all articles
Browse latest Browse all 2504

Trending Articles