While Integrating NetSuite Sales Order I want to map only few items not all from Salesforce.

Comments

8 comments

  • Balasubramanian Mahadevan Community manager Senior Technical Writer
    Engaged
    Celigo University Level 2: Seasoned

    Anil Anwane Are you trying to do the preSavePageFunction  in a custom flow or are you using any of the flows in the Salesforce - NetSuite integration app?

    0
  • Anil Anwane NetSuite Integration Whiz Salesforce Integration Whiz
    Celigo University Level 4: Legendary

    Hi, 

    I have created a custom Standalone flow in Celigo for Salesforce to NetSuite Integration.

    0
  • Balasubramanian Mahadevan Community manager Senior Technical Writer
    Engaged
    Celigo University Level 2: Seasoned

    Hi Anil, 

    Thanks for the information. Since you are using a custom flow to perform this operation, I am moving this to the Troubleshoot custom flows topic for better visibility.

    0
  • Bas van Ditzhuijzen Strategic Partner NetSuite Integration Whiz Salesforce Integration Whiz
    Partner Implementation Certification
    Great Answer
    Answer Pro
    Engaged
    Celigo University Level 4: Legendary

    Don't use for loops for iterating arrays, but use forEach. And then use filter() to remove things you dont need:

    options.data.forEach(order => {
    order.OpportunityLineItems = order.OpportunityLineItems.filter(line => line.DoNotSync__c == 'false');
    });

     

    0
  • Anil Anwane NetSuite Integration Whiz Salesforce Integration Whiz
    Celigo University Level 4: Legendary

    Hi Bas Van,

    I tried using For Each. I am getting same error as given below.

    Extension result doesn't contain the same number of elements as the request object. Expected 1, got . Extension returned statusCode 200.

    Can you please provide me if you have any such function used for removing few line items from SalesOrder.

    Many thanks,

    Anil

    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Anil Anwane can you send what the JSON input of your script is? Can't help much without that.

    0
  • Anil Anwane NetSuite Integration Whiz Salesforce Integration Whiz
    Celigo University Level 4: Legendary

    Hi Tyler Lamparter,

    Please find the input JSON below.

    {
      "data": [
        {
          "Id": "Id",
          "IsDeleted": "IsDeleted",
          "IsPrivate": "IsPrivate",
          "Name": "Name",
          "Description": "Description",
          "StageName": "StageName",
          "Amount": "Amount",
          "Probability": "Probability",
          "ExpectedRevenue": "ExpectedRevenue",
          "TotalOpportunityQuantity": "TotalOpportunityQuantity",
          "CloseDate": "CloseDate",
          "Type": "Type",
          "NextStep": "NextStep",
          "LeadSource": "LeadSource",
          "IsClosed": "IsClosed",
          "IsWon": "IsWon",
          "ForecastCategory": "ForecastCategory",
          "ForecastCategoryName": "ForecastCategoryName",
          "HasOpportunityLineItem": "HasOpportunityLineItem",
          "CreatedDate": "CreatedDate",
          "LastModifiedDate": "LastModifiedDate",
          "SystemModstamp": "SystemModstamp",
          "LastActivityDate": "LastActivityDate",
          "PushCount": "PushCount",
          "LastStageChangeDate": "LastStageChangeDate",
          "FiscalQuarter": "FiscalQuarter",
          "FiscalYear": "FiscalYear",
          "Fiscal": "Fiscal",
          "ContactId": "ContactId",
          "LastViewedDate": "LastViewedDate",
          "LastReferencedDate": "LastReferencedDate",
          "HasOpenActivity": "HasOpenActivity",
          "HasOverdueTask": "HasOverdueTask",
          "DeliveryInstallationStatus__c": "DeliveryInstallationStatus__c",
          "TrackingNumber__c": "TrackingNumber__c",
          "NetSuiteSalesOrder__c": "NetSuiteSalesOrder__c",
          "CurrentGenerators__c": "CurrentGenerators__c",
          "MainCompetitors__c": "MainCompetitors__c",
          "Ammendment_Opportunity_Type__c": "Ammendment_Opportunity_Type__c",
          "RA_Source_Document__c": "RA_Source_Document__c",
          "Account": {
            "Id": "Account.Id"
          },
          "OpportunityLineItems": [
            {
              "Id": "Id",
              "SortOrder": "SortOrder",
              "ProductCode": "ProductCode",
              "Name": "Name",
              "Quantity": "Quantity",
              "TotalPrice": "TotalPrice",
              "UnitPrice": "UnitPrice",
              "ListPrice": "ListPrice",
              "ServiceDate": "ServiceDate",
              "Description": "Description",
              "CreatedDate": "CreatedDate",
              "LastModifiedDate": "LastModifiedDate",
              "SystemModstamp": "SystemModstamp",
              "IsDeleted": "IsDeleted",
              "LastViewedDate": "LastViewedDate",
              "LastReferencedDate": "LastReferencedDate",
              "DoNotSync__c": "DoNotSync__c",
              "End_Date__c": "End_Date__c",
              "Start_Date__c": "Start_Date__c",
              "Product2": {
                "NetSuite_Item_ID__c": "Product2.NetSuite_Item_ID__c"
              }
            }
          ]
        }
      ],
      "_importId": "651125c1d6edd5374f92f456",
      "_connectionId": "6504237d52cd84685a218ae3",
      "_flowId": "650d5657fdc8375a68630ff6",
      "settings": {
        "integration": {},
        "flowGrouping": {},
        "flow": {},
        "import": {},
        "connection": {}
      }
    }
    0
  • Tyler Lamparter Principal Product Manager
    Awesome Follow-up
    Engaged
    Top Contributor
    Answer Pro
    Celigo University Level 4: Legendary

    Anil Anwane what is not working with your script? It's working fine for me. I tested on the below sample and the output was only 1 line and not 2.

    {
          "Id": "Id",
          "IsDeleted": "IsDeleted",
          "IsPrivate": "IsPrivate",
          "Name": "Name",
          "Description": "Description",
          "StageName": "StageName",
          "Amount": "Amount",
          "Probability": "Probability",
          "ExpectedRevenue": "ExpectedRevenue",
          "TotalOpportunityQuantity": "TotalOpportunityQuantity",
          "CloseDate": "CloseDate",
          "Type": "Type",
          "NextStep": "NextStep",
          "LeadSource": "LeadSource",
          "IsClosed": "IsClosed",
          "IsWon": "IsWon",
          "ForecastCategory": "ForecastCategory",
          "ForecastCategoryName": "ForecastCategoryName",
          "HasOpportunityLineItem": "HasOpportunityLineItem",
          "CreatedDate": "CreatedDate",
          "LastModifiedDate": "LastModifiedDate",
          "SystemModstamp": "SystemModstamp",
          "LastActivityDate": "LastActivityDate",
          "PushCount": "PushCount",
          "LastStageChangeDate": "LastStageChangeDate",
          "FiscalQuarter": "FiscalQuarter",
          "FiscalYear": "FiscalYear",
          "Fiscal": "Fiscal",
          "ContactId": "ContactId",
          "LastViewedDate": "LastViewedDate",
          "LastReferencedDate": "LastReferencedDate",
          "HasOpenActivity": "HasOpenActivity",
          "HasOverdueTask": "HasOverdueTask",
          "DeliveryInstallationStatus__c": "DeliveryInstallationStatus__c",
          "TrackingNumber__c": "TrackingNumber__c",
          "NetSuiteSalesOrder__c": "NetSuiteSalesOrder__c",
          "CurrentGenerators__c": "CurrentGenerators__c",
          "MainCompetitors__c": "MainCompetitors__c",
          "Ammendment_Opportunity_Type__c": "Ammendment_Opportunity_Type__c",
          "RA_Source_Document__c": "RA_Source_Document__c",
          "Account": {
            "Id": "Account.Id"
          },
          "OpportunityLineItems": [
            {
              "Id": "Id",
              "SortOrder": "SortOrder",
              "ProductCode": "ProductCode",
              "Name": "Name",
              "Quantity": "Quantity",
              "TotalPrice": "TotalPrice",
              "UnitPrice": "UnitPrice",
              "ListPrice": "ListPrice",
              "ServiceDate": "ServiceDate",
              "Description": "Description",
              "CreatedDate": "CreatedDate",
              "LastModifiedDate": "LastModifiedDate",
              "SystemModstamp": "SystemModstamp",
              "IsDeleted": "IsDeleted",
              "LastViewedDate": "LastViewedDate",
              "LastReferencedDate": "LastReferencedDate",
              "DoNotSync__c": "false",
              "End_Date__c": "End_Date__c",
              "Start_Date__c": "Start_Date__c",
              "Product2": {
                "NetSuite_Item_ID__c": "Product2.NetSuite_Item_ID__c"
              }
            },
            {
              "Id": "Id",
              "SortOrder": "SortOrder",
              "ProductCode": "ProductCode",
              "Name": "Name",
              "Quantity": "Quantity",
              "TotalPrice": "TotalPrice",
              "UnitPrice": "UnitPrice",
              "ListPrice": "ListPrice",
              "ServiceDate": "ServiceDate",
              "Description": "Description",
              "CreatedDate": "CreatedDate",
              "LastModifiedDate": "LastModifiedDate",
              "SystemModstamp": "SystemModstamp",
              "IsDeleted": "IsDeleted",
              "LastViewedDate": "LastViewedDate",
              "LastReferencedDate": "LastReferencedDate",
              "DoNotSync__c": "true",
              "End_Date__c": "End_Date__c",
              "Start_Date__c": "Start_Date__c",
              "Product2": {
                "NetSuite_Item_ID__c": "Product2.NetSuite_Item_ID__c"
              }
            }
          ]
        }

    0

Please sign in to leave a comment.