Package: pandaforce
PandaForceA utility package utilizingpandasandsimple-salesforceOverviewpandaforce contains the following general utility functions:convertTo18:	Converts the passed Salesforce 15-digit ID to an 18-digit Idinfogives an overview of the functions and methods within the pandaforce packageisNull:		Returns boolean value for passed value indicating if it is a Null or NaN valuerepairCasing:	Changes 18-digit IDs that have had all character's capitalized to a Salesforce viable 18-digit IdIt also contains aloginclass which initiates a connection to a Salesforce org. It contains the following methods:dml: Runs the specified bulk CRUD command with the passed datagetdf: Returns pandas dataframe from passed SOQL querygetObjectFields: Returns list of all field names in the passed Salesforce object namegetObjectFieldsDict: Returns all fields of passed Salesforce object name as {label:name} dictionarygetReport: Returns pandas dataframe from passed Salesforce report Id (15 or 18 digit)isObject: Accepts string argument. Returns boolean.Connecting to a Salesforce OrgTo connect to your Salesforce Org, create aloginclass instance withvar = pandaforce.login().loginrequires the following parameters:username= string of your Salesforce login usernamepassword= string of your Salesforce login passwordorgid= string of your Salesforce organization id, as found on theCompany Informationsetup page of your orgThere are also two optional parameters,securitytokenandsandbox.securitytokendefaults to a blank string (''), but can accept your login security tokensandboxdefaults toFalse, but must be passed asTrueto access a sandbox within of your org. If you are accessing a sandbox, you must also append'.your_sandbox_name'to the end of your username, as you would when logging in to a normal Salesforce sandbox.You can have any number oflogininstances running within a given script. Each instance should be assigned to a different variable. The default example login instance in this document will besf.Login Class Methods (Details)checkObjectTheisObjectmethod accepts one string parameter, and searches your Salesforce org for an object with a name matching that parameter. It is not case sensitive. The search is by object name, not object label, so make sure to inlude underscores (_) and to append__cfor custom objects.The method returns boolean.Truemeans the object was found in the org's metadata,Falsemeans the opposite.dmlThedmlmethod evokes a bulk CRUD (Created, Update, Delete) command into your Salesforce org. These changes are permanent, so be cautious when using this method.dmlparameters are as follows:obj: the name of the Salesforce object (not its label) as a stringuptype: the type of CRUD function to be executed. Options areinsert,update,delete, andhard_deleteas a stringdata: this parameter must be alistofdictionaries. Each value in the list represents a record, and the dictionaries must be formatted as noted below:insert: `{'field_names':field_values_as_type_in_salesforce}'update:{'Id':'15_or_18_digit_Id_as_String','field_names':field_values_as_type_in_salesforce}deleteandhard_delete: `{'Id':'15_or_18_digit_Id_as_String'}dmlreturns a list of dictionaries, as formatted in the example below:[{'success': True, 'created': False, 'id': '0030v000000000000B', 'errors': []},
 {'success': True, 'created': False, 'id': '0030v000000000000N', 'errors': []},
 {'success': False,'created': False,'id': None,'errors': [{'message': 'Please update phone number format to: (XXX) XXX-XXXX',
    'fields': ['MobilePhone'],
    'statusCode': 'FIELD_CUSTOM_VALIDATION_EXCEPTION',
    'extendedErrorDetails': None}]},To capture thedmlresults, assign a variable to the dml command. For example:r = sf.dml('Custom_Object__c','delete','myData')Insert Examplesf = login(login_criteria_here)

myData = [{'Name':'First Record','Field_A__c':'A value','Number_Field__c':123},
           'Name':'Second Record','Field_A__c':'Another value','Number_Field__c':456}]

sf.dml('Custom_Object__c','insert',myData)Update Examplesf = login(login_criteria_here)

myData = [{'Id':'000000000000001','Name':'First Record','Field_A__c':'A value','Number_Field__c':123},
           'Id':'000000000000002','Name':'Second Record','Field_A__c':'Another value','Number_Field__c':456}]

sf.dml('Custom_Object__c','update',myData)Delete Examplesf = login(login_criteria_here)

myData = [{'Id':'000000000000001'},
           'Id':'000000000000002'}]

sf.dml('Custom_Object__c','delete',myData)Dot Notation ExampleBecause theloginclass initiates aSalesforceclass from thesimple-salesforcepackage, you can also run a dml statement through dot notation. A dml statement in this fashion would look like the following:sf.Org.Custom_Object__c.update(myData)The.Orgcomponent betweensf.and.Custom_Object__cis required as the Simple SalesforceSalesforceclass is housed within theloginclass instance.getObjectFieldsThegetObjectFieldsmethod returns list of all field names in the passed Salesforce object name. The passed value must be a string, and be the name of the Salesforce object, not the label (i.e.,'Custom_Object__c'rather than'Custom Object')getObjectFieldsDictThegetObjectFieldsDictmethod returns all fields of passed Salesforce object name as dictionary, using a {label:name} format. LikegetObjectFields, the passed string must be the name of the Salesforce object, not the label (i.e.,'Custom_Object__c'rather than'Custom Object')getReportThegetReportmethod returns a pandas dataframe from passed Salesforce report Id (15- or 18-digit). This method only works on tabular Salesforce reports, and will only return the text value of any hyperlinked text (i.e. The 'Name' field on the report will appear in the dataframe as the text of the name, not a link to the record or the record's 15- or 18-digit IdPandaforce InheritanceAs its name implies, Pandaforce heavily utilizespandasandsimple-salesforce, so any functionality of those packages will apply to this package as well.For example, dataframes returned from methods such asgetdf()orgetReportare pandas DataFrames, so all DataFrame methods from the pandas package will function on it. Likewise, theOrgvariable in eachlogininstance is a simple-salesforce Salesforce class, and its methods are accessible as well.