Creates a record in a file of a Salesforce database. This file can be a preset file or a custom file.
Remark: A "Salesforce record" is also called a "Salesforce object".
// Connexion à Salesforce
Cnx is sfConnection
Cnx.Login = "balthazar@gmail.com"
Cnx.Password = "azerty" + "XXB12VCZ54"
IF SFConnect(Cnx) = False THEN
Error("La connexion a échoué")
RETURN
END
// Définition des enregistrements
MesEnregistrements is array of sfObject
UnEnregistrement is sfObject
UnEnregistrement.ObjectType = "Mileage__c"
UnEnregistrement..Date__c = "2009-02-14"
UnEnregistrement..Miles__c = 333
Add(MesEnregistrements, UnEnregistrement)
UnEnregistrement..Date__c = "2009-02-15"
UnEnregistrement..Miles__c = 222
Add(MesEnregistrements, UnEnregistrement)
// Ajout des enregistrements
tabRes is array of sfSaveResult
tabRes = SFAdd(Cnx, MesEnregistrements)
// Lecture du résultat
res is sfSaveResult
err is sfError
FOR EACH res OF tabRes
Trace("---------- " + res.ID + ": " + res.Success + " ----------")
FOR EACH err OF res..Error
Trace("Erreur: " + err.ErrorCode + " -> " + err.Message + "(" + err.Item + ")")
END
END
Syntax
<Result> = SFAdd(<Salesforce connection> , <Records to create>)
<Result>: Array variable
Array of sfSaveResult variables containing the result data, especially the identifiers of records actually created.
<Salesforce connection>: sfConnection variable
Name of the Variable type sfConnection to be used.
<Records to create>: Array variable
Array of sfObject variables corresponding to the records (Salesforce objects) to create.
Remarks
Possible error cases:
- The Internet connection is not valid.
- The authentication was not performed properly.
- The XML response of the server cannot be read.
To find out whether an error occurred, use the
ErrorOccurred variable.