/
Generic entities
Generic entities
Any entity can be queried via the GenericEntity class without having to define a strongly-typed schema.
Create a new lead
var session = serviceFactory.GetSessionFromConnectionString("MyDynamicsInstance");
// Field values are set with Dictionary<string, object>.
var fieldValues = new Dictionary<string, object>() {
{ "firstname", "John" },
{ "lastname", "Smith" },
{ "emailaddress1", "example@example.com" }
};
var lead = await GenericEntity.InsertAsync(session, "lead", fieldValues);
Load an existing lead
var session = serviceFactory.GetSessionFromConnectionString("MyDynamicsInstance");
// Find a lead by email address.
var lead = await GenericEntity.LoadSingleAsync(session, "lead",
(query, exp) =>
{
query.Filter("emailaddress1 eq 'example@example.com'").Select("firstname, lastname");
}
);
// Returned objects support Dictionary syntax to access fields.
Console.WriteLine($"First name: {lead["firstname"]}, Last name: {lead["lastname"]}");
Update an existing lead
// Change a field value on a previously loaded lead.
lead["lastname"] = "Jones";
await lead.UpdateAsync(session);
, multiple selections available,
Related content
Install S4D
Install S4D
More like this
Connections and Licensing
Connections and Licensing
Read with this
Update an Existing Lead
Update an Existing Lead
More like this
API authentication and security
API authentication and security
Read with this
Working with the SalesforceGenericEntity
Working with the SalesforceGenericEntity
More like this
S4D Identify Contact Submit Action
S4D Identify Contact Submit Action
Read with this