15

I just want to know what is SObjectScriptRow! All I can find about it is this question.

I'm building an invocable method to be used from a process, where I have one input parameter: a list of an sObject type.

Here is the code:

@InvocableMethod(label='Update fees' description='It takes a list of parent fees and updates the related child fees')
global static void ParentFeeUpdateChildFees(List<Parent_Fee__c> parentFees) {

    List<Child_Fee__c> childFees = [SELECT Parent_Fee__c, Fee_Percentage__c, Charge__c FROM Child_Fee__c WHERE Parent_Fee__c IN :parentFees];
    Map<Id,Parent_Fee__c> parentFeeMap = new Map<Id,Parent_Fee__c>(parentFees);

    Parent_Fee__c parentFee;
    for (Child_Fee__c childFee : childFees){                
        parentFee = parentFeeMap.get(childFee.Parent_Fee__c);
        childFee.Fee_Percentage__c = parentFee.Fee_Percentage__c;
        childFee.Charge__c = parentFee.Charge__c;
    }
    update childFees;
}

And I'm getting the following error

FLOW_ELEMENT_ERROR An Apex error occurred: System.UnexpectedException: Bad rightOperand type: got SObjectScriptRow: operator e dataType 1

So, I think the error is being thrown at the :parentFees meaning I can't query by the parameter because I'm actually getting a list of SObjectScriptRow instead of a list of sObject.

I can simply change the method to receive a list of Ids and this will work, but It will add an extra query to get the Parent Fees which I want to avoid.

I would appreciate any input in this, or maybe I'm mistaken. Thanks!

7
  • 1
    The clause WHERE Parent_Fee__c IN :parentFees is expecting a list of ids to be in parentFees. Since you have a list of sObjects, it's never going to work. However, if you extract the parentFee Id from the list of parentFees in a loop prior to the query, you can put it in a set and query that. Jan 26, 2016 at 17:07
  • Hi @CasparHarmer, you can actually query by a list of sObjects. Just try the following List<Account> accounts = [SELECT Id, Name FROM Account limit 10]; List<Contact> contacts = [SELECT Name FROM Contact WHERE AccountId IN :accounts]; and you'll see that you get a list of contacts. I know I have several workarounds to get this to work (like putting the ids in a set), but I just want to know what is SObjectScriptRow! and why am I getting that.
    – Jose
    Jan 26, 2016 at 17:23
  • 2
    @AdrianLarson that'd work just fine, but that's another workaround and wouldn't answer my question.
    – Jose
    Jan 27, 2016 at 0:51
  • 1
    You have answered this question as well as it is possible to answer without insider knowledge. Basically, it represents an SObject that has been passed in through a Process Builder flow. While there are some people on this network with some such knowledge, your best course of action is to open a ticket with support.
    – Adrian Larson
    Jan 28, 2016 at 18:07
  • 1
    I am receiving the same issue with my process builder which invokes a apex. Is there any workaround for this now ?
    – Ruchi
    Sep 14, 2018 at 19:10

1 Answer 1

1

Ran into the same issue and resolved by changing my method parameter from List<SObject> to List<Id>, worked like a charm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .