Monday, November 20, 2017

ScoreIntelligence object

This is the core object for the Einstein Lead Score feature, which one would need when programming trigger off (or for) it.  However I couldn't find official documentation on it (other than mentions in Release Notes).  It's not in the SOAP API Developer Guide, which is usually the (authoritative) place for standard object reference.  It does have ScratchOrgInfo, which belongs to Salesforce DX, a feature came out as GA in the same (or later) release (Summer '17) as Sales Cloud Einstein.  In terms of being "API first", that's strike one for Einsten.  Just saying...

So here's what I can glean from standard describe in Apex.

API NameLabel
ObjectScoreIntelligenceScore Intelligence
Field 1IdScore Intelligence Id
Field 2BaseIdLead Id
Field 3ScoreEinstein Score
All look pretty self-explanatory.  The interesting thing is that from the BaseId field, it looks like the object is a child object of Lead's, but through Apex/Process/SOQL the score can also be accessed as ScoreIntelligence.Score from the Lead object - something I know to be true (as we use it that way) but again cannot point to documentation - which means it's also a parent object of Lead's. 

Appendix: Apex script if you want to see the raw output.
        Schema.DescribeSObjectResult result = ScoreIntelligence.sObjectType.getDescribe();

        system.debug(result);

        system.debug(result.fields.getMap());

        for (String s : result.fields.getMap().keyset()) {

            system.debug(result.fields.getMap().get(s).getDescribe());
        }

No comments:

Post a Comment