SalesforceCommerceCloud / b2c-crm-sync

... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
https://salesforcecommercecloud.github.io/b2c-crm-sync/
BSD 3-Clause "New" or "Revised" License
65 stars 45 forks source link

Error when deploying to production via changesets #140

Closed ranveer5289 closed 2 years ago

ranveer5289 commented 2 years ago

Hello,

I am very new to SFSC and am trying to deploy the connector to production via changesets.

I have created the changesets and now when I try to deploy it the test cases are failing with the below errors.

Error 1

System.QueryException: List has no rows for assignment to SObject
Stack Trace: Class.B2CIACustomerResolution_TestHelper.getRecordType: line 299, column 1 Class.B2CIACustomerResolution_TestHelper.createContact: line 248, column 1 Class.B2CIACustomerResolution_Test.testResolveByB2CCustomerIDSingleResultFromMultiple: line 239, column 1

Error 2

System.UnexpectedException: common.exception.SfdcSqlException: ORA-00920: invalid relational operator
Stack Trace: Class.Query.toSObjectList: line 1546, column 1 Class.Query.run: line 1526, column 1 Class.QueryTest.ascendAndNullsLastOrderTest: line 677, column 1

For Error-1, I tried creating a small POC on production and for me the below code (extracted from connector) works perfectly fine and I get the record Id.

String x = getAccountRecordTypeDeveloperName();
System.debug(x);
RecordType ty = getRecordType(x);
System.debug(ty.Id);
public static String getAccountRecordTypeDeveloperName() {

    // Initialize local variables
    B2C_CRM_Sync_Default_Configuration__mdt configurationProfile;
    String output;

    if (
        // Validate that we have CRUD permissions to access this data
        B2C_CRM_Sync_Default_Configuration__mdt.SObjectType.getDescribe().isAccessible() &&
        Schema.SObjectType.B2C_CRM_Sync_Default_Configuration__mdt.fields.DeveloperName.isAccessible() &&
        B2C_CRMSync_Setting__mdt.SObjectType.getDescribe().isAccessible() &&
        Schema.SObjectType.B2C_CRMSync_Setting__mdt.fields.Account_Record_Type_Developername__c.isAccessible()
    ) {

        // Get the default configuration profile
        configurationProfile = [
            SELECT Active_Configuration__r.Account_Record_Type_Developername__c
            FROM B2C_CRM_Sync_Default_Configuration__mdt
            WHERE DeveloperName = 'Production_Configuration'
            LIMIT 1
        ];

        // Set the output variable to contain the specified configuration property
        output = configurationProfile.Active_Configuration__r.Account_Record_Type_Developername__c;

    }

    // Return the configured account / recordType developerName
    return output;

}

public static RecordType getRecordType(String recordTypeDeveloperName) {

    // Initialize local variables
    RecordType output;

    // Retrieve the specified recordType using the developerName that is passed in
    output = [ SELECT Id, DeveloperName FROM RecordType WHERE DeveloperName = :recordTypeDeveloperName ];

    // Return the query results
    return output;

}

So any idea why these test cases are failing and what can we do to fix this? It will be great if Salesforce can add some information on how to deploy this connector to production as I believe most of the people who are going to use the connector are very new to SFSC.

ranveer5289 commented 2 years ago

It turned out one of the fields didn't had appropriate access.