-2

can someone please help me with this issue can't parse argument number: org: First error: can't parse argument number: org

This is the Batchable class:

global with sharing class IMB_SendPushNotificationsBatchable implements Database.Batchable<SObject> { 
public IMB_NotificationHelper helper = new IMB_NotificationHelper();
public IMB_REST_Model_Notification model = new IMB_REST_Model_Notification();

public String pushNotificationLabel {get; set;}

global IMB_SendPushNotificationsBatchable(String pushNotificationLabel){
    this.pushNotificationLabel = pushNotificationLabel;
}

global Database.QueryLocator start(Database.BatchableContext BC){
    return Database.getQueryLocator(IMB_SendPushNotificationsBatchable.generateQuery(this.pushNotificationLabel));
}

global void execute(Database.BatchableContext BC, List<Internship_Request__c> inputRequests){

    for(Internship_Request__c request : inputRequests){

        Notification__c notification = this.model.GenerateNotificationFromInternshipRequest(request, this.pushNotificationLabel);
        IMB_REST_Model_Notification output = new IMB_REST_Model_Notification(notification, true);

        IMB_NotificationHelper.SendPushNotification(request.Student__c, 
                                                    pushNotificationLabel,          // label/name of the push notification                         
                                                    output.Message,                 // notification message
                                                    output.MobileDestinationId,     // mobiledestinationId
                                                    output.MobileDestinationView);  //mobiledestinationView
    }
}

global void finish(Database.BatchableContext BC){}

public static String generateQuery(String pushNotificationLabel){
    return  pushNotificationLabel == 'Expected Internship End' ? 
    'SELECT Id, Internship__c, Student__c, Internship__r.Company__r.Name, Internship__r.Name, Expires__c, End__c, Set_Up_Initiated_By__r.Name FROM Internship_Request__c WHERE Status__c = \'In Progress\' AND End__c = LAST_N_DAYS:7' : 
    'SELECT Id, Internship__c, Student__c, Internship__r.Company__r.Name, Internship__r.Name, Expires__c, End__c, Set_Up_Initiated_By__r.Name FROM Internship_Request__c WHERE Status__c = \'Approved To Pursue\' AND Expires__c = LAST_N_DAYS:3';
}

}

Schedulable class:

global with sharing class IMB_SendPushNotificationsSchedulable implements Schedulable{

global void execute(SchedulableContext sc){
    IMB_SendPushNotificationsBatchable expectedInternshipEnd = new IMB_SendPushNotificationsBatchable('Expected Internship End');
    IMB_SendPushNotificationsBatchable requestExpiringSoon = new IMB_SendPushNotificationsBatchable('Request Expiring Soon');

    database.executebatch(expectedInternshipEnd,10);
    database.executebatch(requestExpiringSoon,10);
}

}

Thank you

1

Somewhere in the execute method of your batch there seems to be type mismatch error like variable declared as integer getting a string type value assignment.

I would suggest you to put the try catch block in your execute method and in catch try to print the complete error message and stack trace and then check the logs after execution you might be able to find the exact line where the exception is ocurring.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.