• Jess Robinson
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 5
    Replies
Hi all, 

I want to set up some test data for my scratch orgs so I don't have to create it manually in every new org. I have simple sobjects sorted but I need to use queues and I cannot get the import working. I have the following json files from this command:
sfdx force:data:tree:export --query "SELECT Id, Name, (SELECT SobjectType FROM QueueSobjects) FROM Group" --prefix export --outputdir data-import --plan

export-groups.json:
{
    "records": [
        {
            "attributes": {
                "type": "Group",
                "referenceId": "GroupRef1"
            },
            "Name": "test queue"
        }
    ]
}

export-queues.json:
{
    "records": [
        {
            "attributes": {
                "type": "QueueSobject",
                "referenceId": "QueueSobjectRef1"
            },
            "SobjectType": "Lead",
            "QueueId": "@GroupRef1"
        }
    ]
}
The plan:
[
    {
        "sobject": "Group",
        "saveRefs": true,
        "resolveRefs": false,
        "files": [
            "export-groups.json"
        ]
    },
    {
        "sobject": "QueueSobject",
        "saveRefs": false,
        "resolveRefs": true,
        "files": [
            "export-queues.json"
        ]
    }
]


But every time I try running the import, I get this error:

ERROR running force:data:tree:import: {"hasErrors":true,"results":[{"referenceId":"QueueSobjectRef1","errors":[{"statusCode":"INVALID_CROSS_REFERENCE_KEY","message":"invalid cross reference id","fields":[]}]}] }

Any help would be much appreciated!


 
I am trying to create an Event in a scratch org and am receiving this error:
Data Not Available
The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page. 

Creating a task works fine. I get the same error creating an event on both accounts and leads. I tried creating the event via Apex:
Event newEvent = new Event(Subject='Hello', Type='Email', ActivityDateTime=2017-10-18T00:00:00.000Z, DurationInMinutes=5);
insert newEvent;

But that code won't run, with this error:
Line: 1, Column: 7
Unexpected token 'newEvent'.


 
Hi all, 
I am seeing this exception: System.LimitException: Maximum stack depth reached: 5
on a Database.query call in a scheduled job. Have tried the job running as Scheduled, Asynchronous and Queueable and it happens in every instance, but only intermittently. Could anyone shed any light on what might be causing this? 

Code:
string soqlString = 'select count(Id) activeCount, OwnerId from '+team.Object_name__c+' where '+
                (team.Object_name__c == 'Lead' ? 'IsConverted = false and ' : '') +
                'OwnerId IN :memberUserIdsList and '+team.Object_active_status_field_name__c+' IN :statusValueList'+
                ' group by OwnerId';
      for (sObject sObj : Database.query(soqlString)) { <-- Exception occurring here
        AggregateResult ar = (AggregateResult)sObj;
        id memberOwnerId = (string)ar.get('OwnerId');
        integer activeObjectCount = (integer)ar.get('activeCount');
        Team_member__c teamMember = memberByUserIdMap.get(memberOwnerId);
        teamMember.Number_of_active_objects__c = activeObjectCount;
      }


 
Hey all, 

A customer of ours is getting a DML timeout on trying to delete a record. This is happening in our managed package but the actual DML statement itself is taking over 2 minutes then timing out:
    15:10:08.0 (616407588)|DML_BEGIN|[257]|Op:Delete|Type:n2__Team_member__c|Rows:1
    15:12:14.914 (126914472863)|DML_END|[257]

Has anyone encountered this before and knows how we can diagnose the issue? I have tried Salesforce support but there is nowhere for ISVs to get help with customer issues, and they have redirected me here.

Thanks in advance 
Does anyone know how frequently queueable jobs are supposed to run when chained? 

This post - https://developer.salesforce.com/blogs/engineering/2014/10/new-apex-queueable-interface.html - suggests it should be every minute, reliably but we have jobs that only run up to every 3 minutes. The post is also nearly 2 years old and I can't find any more recent information on the subject.

Thanks.
I have some code that starts a Queueable job, which then chains to create the next Queueable job and so on. 

When I abort one of the Queueable jobs manually in the Apex Jobs list, it shows as having aborted successfully but then a couple of minutes later, it starts another Queueable job and the aborted job changes to 'Completed'. Has anyone else noticed this? 
According to the Help for Apex Flex Queue, you can manage jobs placed in the queue via the 'Apex Flex Queue' page, under Setup -> Jobs.
I've just activated the critcal update but there is no new page for these jobs. Does this take some time to be enabled after activation, or is there no page available for this?

Thanks.
According to this - https://developer.salesforce.com/releases/release/Spring15/FlexQueue - in Spring '15, there will be a delay of 5 minutes between chained Scheduled Apex jobs.

When will this delay be released? There is currently a critical update waiting called 'Apex Flex Queue'. I'm unclear whether the delay is part of this critical update, or is a separate one and if so, when it will be released?
I have some code that starts a Queueable job, which then chains to create the next Queueable job and so on. 

When I abort one of the Queueable jobs manually in the Apex Jobs list, it shows as having aborted successfully but then a couple of minutes later, it starts another Queueable job and the aborted job changes to 'Completed'. Has anyone else noticed this? 
Our goal is to merge Contacts (and later Accounts) in Salesforce CRM. Our data is already polluted therefore we can't rely on merge rules that are triggered only for new/changed contacts.

Therefore we think that we need to utilize Apex code however we are running into some issues that seem to have to do not with the code but with the permissions:
(Important to note about the code below, the emails in the contacts are fake and can therefore be ignored completely when merging).
public class MergeRule {
    public static void applyMergeRule() {
        AggregateResult[] contacts = [
            SELECT Name, BirthDate, COUNT(Email) nr
            FROM Contact GROUP BY Name, BirthDate
            HAVING COUNT(Email)>1
        ];
        for (AggregateResult contact_group: contacts) {
            String name = (String)contact_group.get('Name');
            Date birth_date = (Date)contact_group.get('BirthDate');
            Contact[] contact_subgroup = [
                SELECT Id, Name, BirthDate
                FROM Contact
                   WHERE Contact.Name = :name
                   AND Contact.BirthDate = :birth_date
						];
            for (Integer i=1; i<contact_subgroup.size(); i++){
								// This line produces the error 👇 🔔
                merge contact_subgroup[0] contact_subgroup[i];
            }
        }
    }
}

We receive the following error:
14:07:03:138 FATAL_ERROR System.DmlException: Merge failed. First exception on row 0 with id 0035r000002VYMoAAO; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [Name]
We have tried to change the field level security for the profile System Admin on the field Name for the Contacts object, however, we found that there is no way to change this field. We tried this due to the suggestions in this thread on the salesforce development forum (https://developer.salesforce.com/forums/?id=9060G0000005PvhQAE) and this thread on the salesforce stackexchange (https://salesforce.stackexchange.com/questions/69857/how-to-check-whether-a-user-has-write-access-to-a-field), however, we are not completely sure that we interpreted these threads correctly (maybe we need to change the permissions for other profiles, objects or fields instead of the ones above?)

I hope that you can help us with this issue.
Hi all, 
I am seeing this exception: System.LimitException: Maximum stack depth reached: 5
on a Database.query call in a scheduled job. Have tried the job running as Scheduled, Asynchronous and Queueable and it happens in every instance, but only intermittently. Could anyone shed any light on what might be causing this? 

Code:
string soqlString = 'select count(Id) activeCount, OwnerId from '+team.Object_name__c+' where '+
                (team.Object_name__c == 'Lead' ? 'IsConverted = false and ' : '') +
                'OwnerId IN :memberUserIdsList and '+team.Object_active_status_field_name__c+' IN :statusValueList'+
                ' group by OwnerId';
      for (sObject sObj : Database.query(soqlString)) { <-- Exception occurring here
        AggregateResult ar = (AggregateResult)sObj;
        id memberOwnerId = (string)ar.get('OwnerId');
        integer activeObjectCount = (integer)ar.get('activeCount');
        Team_member__c teamMember = memberByUserIdMap.get(memberOwnerId);
        teamMember.Number_of_active_objects__c = activeObjectCount;
      }


 
Hey all, 

A customer of ours is getting a DML timeout on trying to delete a record. This is happening in our managed package but the actual DML statement itself is taking over 2 minutes then timing out:
    15:10:08.0 (616407588)|DML_BEGIN|[257]|Op:Delete|Type:n2__Team_member__c|Rows:1
    15:12:14.914 (126914472863)|DML_END|[257]

Has anyone encountered this before and knows how we can diagnose the issue? I have tried Salesforce support but there is nowhere for ISVs to get help with customer issues, and they have redirected me here.

Thanks in advance 
According to this - https://developer.salesforce.com/releases/release/Spring15/FlexQueue - in Spring '15, there will be a delay of 5 minutes between chained Scheduled Apex jobs.

When will this delay be released? There is currently a critical update waiting called 'Apex Flex Queue'. I'm unclear whether the delay is part of this critical update, or is a separate one and if so, when it will be released?