• Sibasish Panigrahi
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies
Hi,
We are trying to integrate Salesforce with Sharepoint using REST API's but the problem is that there's OKTA in between them.
The userId and password which we have for Sharepoint is through OKTA. In browser, the user logs in into OKTA and from there it continues with Sharepoint. So when we try to authenticate Sharepoint directly through Salesforce, it gives error.

Is there any way to  bypass OKTA while integrating Salesforce - Sharepoint?

Thanks.
I have a vf page where i'm fetching data from controller.
I face issue when i click  on a button and the panel get refreshed. After refresh i sometime get's the data on vf page from controller and sometimes not, but in debug i always get the required data in controller. If my data doesn't show up, i refresh the whole page 2-3 times and then again click the button and the required data get's displayed. But after 1-2 times it again fails to do the same and i have to repeat the procedure again.

It's wierd and also i'm not getting how to solve it and also unable to get the root cause.

Thanks.

Trying to configure Single Sign-On between Salesforce and Sharepoint Online.
I have geneated certificates as "Identity Provider" from Salesforce.

I followed Salesforce documentation of Configuring SSO between the same but seems like it doesn't work for SharePoint online.
I also downloaded SharePoint Online Management Shell.

What further steps should be taken from SharePoint side for the configuration?
Do we need any token from SharePoint?

I'm trying to integrate amazon with salesforce since day's but got stucked. Although i'm providing the correct "Access Key", "Security Key", "Token" etc, the error keeps on popping up.
Can anyone help me to figure out where i'm wrong?
List<AmazonMWS__c> amazonList = AmazonMWS__c.getall().values();
    	
    	//Current time in GMT ISO 8601
        String timestamp = datetime.now().formatGMT('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'');
        timestamp = EncodingUtil.urlEncode(timestamp,'UTF-8');
        
        //Amazon Variables
        String action = 'ListOrders';
        String version = '2013-09-01';
        String signatureVersion = '2';
        String signatureMethod = 'HmacSHA256';
        String marketplaceId= amazonList[0].Marketplace_ID__c;
        String marketplaceToken = amazonList[0].MWSAuthToken__c;
        String fulfillmentChannel = 'AFN';
        String sellerId = amazonList[0].Seller_ID__c;
        String endpoint = 'https://mws.amazonservices.com/Orders/2013-09-01';
        String accessKey = amazonList[0].AWSAccessKey__c;
        String amazonSecretKey = amazonList[0].Secret_Key__c;
        
        //Construct a query string with the query information
        String queryString = 'AWSAccessKeyId=' + accessKey + 
				            '&Action=' + action  +
				            '&SellerId=' + sellerId +
				            '&MWSAuthToken=' + marketplaceToken  +
				            '&SignatureVersion=' + signatureVersion  +
				            '&Timestamp=' + timestamp  +
				            '&Version=' + version +
				            '&SignatureMethod=' + signatureMethod  +
				            '&CreatedAfter=2016-09-28T18%3A30%3A00Z' +
				            '&MarketplaceId.Id.1=' + marketplaceId  ;
        
        String stringtoSign = 'POST' + '\n' +
				            'mws.amazonservices.com' + '\n' +
				            '/Orders/2013-09-01' + '\n' +
				            queryString;
        
        //Covert query string to signature using Amazon secret key as key
        Blob mac = Crypto.generateMac('HMacSHA256', blob.valueof(stringtoSign),blob.valueof(amazonSecretKey));
        String signature = EncodingUtil.base64Encode(mac);
        signature = EncodingUtil.urlEncode(signature,'UTF-8');

        system.debug('signature '+signature);
    	
    	HttpRequest req = new HttpRequest();    
        
        req.setEndpoint(endpoint +'?AWSAccessKeyId=' + accessKey +
			            '&Action=' + action +
			            '&SellerId=' + sellerId +
			            '&MWSAuthToken=' + marketplaceToken  +
			            '&SignatureVersion=2' +
			            '&Timestamp=' + timestamp +
			            '&Version=' + version+
			            '&Signature=' + signature +
			            '&SignatureMethod='+ signatureMethod+
			            '&CreatedAfter=2016-09-28T18%3A30%3A00Z' +
			            '&MarketplaceId.Id.1=' + marketplaceId);
        
       req.setMethod('POST');
       system.debug('req'+req);
       Http http = new Http();
       HttpResponse res = http.send(req);
       system.debug(res.getStatus());
       system.debug(res.getStatusCode());
       system.debug(res.getBody());

 
I have created a lookup field in Account and while creating a trigger i used this "Check__c" to create new instance of that particular lookup.
eg: Check__c obj = new Check__c();
But this error keeps poping up.

(Note: Due to restriction i'm unable to share the code or actual field and object name. And i had checked TONS on times that i had used double underscore while using the custom object)
I have a vf page where i'm fetching data from controller.
I face issue when i click  on a button and the panel get refreshed. After refresh i sometime get's the data on vf page from controller and sometimes not, but in debug i always get the required data in controller. If my data doesn't show up, i refresh the whole page 2-3 times and then again click the button and the required data get's displayed. But after 1-2 times it again fails to do the same and i have to repeat the procedure again.

It's wierd and also i'm not getting how to solve it and also unable to get the root cause.

Thanks.
Suggest a soql query to find duplicates in Account objects . R1_ACC_TXT_Id_Golden_record__c is a primay key on our Account object.I am using below query to find all instnaces of an Account in our org but the query is timing out.
SELECT count(Id) FROM Account GROUP BY R1_ACC_TXT_Id_Golden_record__c HAVING count(Id)>1 
Hello, i'm an admin who is rather inexperienced at Apex but this project was kind of dumped in my lap by a developer who has other positions he's filling right now, and I am in need of help since I can't find an answer to my particular problem. I am trying to test this query class and the test class keeps bringing the "attempt to de-reference a null object" error and I'm super confused. It's referring to line 6 in the test class so something with invoking the class is off, it seems but my lack of knowledge isn't particularly helping me figure out what I need to do. I'll leave the code for the class and test class below:
Class
public class AlroOrderBoMQuery {
	public Production_Tracking_Record__c custObj;
    public string HsgMat { get; set; }
    public string ECMat { get; set; }
    public string WPMat { get; set; }
    public string ThrtMat { get; set; }
    public string LnrMat { get; set; }
    
public AlroOrderBoMQuery(){
    }    
    
    public AlroOrderBoMQuery(ApexPages.StandardController controller){
        custObj=(Production_Tracking_Record__c)controller.getRecord();
        
           }
		Production_Tracking_Record__c ptr = [Select Id, Name, Product__c from Production_Tracking_Record__c where id =: custObj.Id limit 1];
    	
    	Product2 prod = [Select Id, Housing_Assembly__c, Drive_Endcap_Assembly__c, Tail_Endcap_Assembly__c, Housing_Material__c, Liner_Material__c, Endcap_Material__c, Wearplate__c, Housing_Throat_Plates__c from Product2 where id =: ptr.Product__c limit 1];
    	{
        HsgMat = prod.Housing_Material__c;
        ECMat = prod.Endcap_Material__c;
        WPMat = prod.Wearplate__c;
        ThrtMat = prod.Housing_Throat_Plates__c;
        LnrMat = prod.Liner_Material__c;
    	}
		List<Housing_Assembly_Attachment__c> HsgAsmAtt = [SELECT Quantity__c, Name, Id, Housing_Assembly__c FROM Housing_Assembly_Attachment__c WHERE Housing_Assembly__c =: prod.Housing_Assembly__c];
    	public List<Housing_Assembly_Attachment__c> getHsgAsmAtt() {
        return HsgAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> DECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Drive_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getDECAsmAtt() {
        return DECAsmAtt;
    	   }
    	List<Endcap_Assembly_Attachment__c> TECAsmAtt = [SELECT Quantity__c, Name, Id, Endcap_Assembly__C FROM Endcap_Assembly_Attachment__c WHERE Endcap_Assembly__c =: prod.Tail_Endcap_Assembly__c];
    	public List<Endcap_Assembly_Attachment__c> getTECAsmAtt() {
        return TECAsmAtt;
    	}

    	
}

Test Class
@isTest
    private class TestAlroOrderBoMQuery {
        public static List<Opportunity> OpportunityList;
    
      static testMethod void TestAlroOrderBoMQuery() {
          AlroOrderBoMQuery BOM = new AlroOrderBoMQuery();

         
        Make__c make = new Make__c(Name='Kice');
        insert make;
        Model__c model = new Model__c(Name='Kice VJ 14x10x10',
                                     Make__c=make.Id,
                                     Product_Passage__c='Drop Thru');
        insert model;
        Housing_Assembly__c hsasm = new Housing_Assembly__c(Name='Kice Housing 1',
                                                            Model__c=model.Id,
                                                            Product_Passage__c='Drop-Through',
                                                            Housing_Type__c='Rebuild',
                                                            verified__c=true);
        insert hsasm;
        Housing_Assembly_Attachment__c hsasmatt = new Housing_Assembly_Attachment__c(Name='Drawing 1',
                                                                                    Housing_Assembly__c=hsasm.Id,
                                                                                    Quantity__c=1);
        insert hsasmatt;
        Attachment hsgatt = new Attachment(Name='Test Housing Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Housing Attachment'),
                                        IsPrivate=false);
        insert hsgatt;
        Endcap_Assembly__c ecasm = new Endcap_Assembly__c(Name='Kice Endcap 1',
                                                          Model__c=model.Id,
                                                          Endcap_Type__c='Rebuild',
                                                          Configuration__c='Inboard',
                                                          verified__c=true);
        insert ecasm;
        Endcap_Assembly_Attachment__c ecasmatt = new Endcap_Assembly_Attachment__c(Name='Drawing 2',
                                                                                    Endcap_Assembly__c=ecasm.Id,
                                                                                    Quantity__c=1);
        insert ecasmatt;
        Attachment ecatt = new Attachment(Name='Test Endcap Attachment.jpg',
                                        ParentId=hsasmatt.Id,
                                        Body=Blob.valueOf('Test Endcap Attachment'),
                                        IsPrivate=false);
        insert ecatt;
        Product2 prod = new Product2(Name='Test Product',
                                     Family='Kice',
                                     IsActive=true,
                                     Inboard_or_Outboard__c='Inboard',
                                     Rotor_Configuration__c='Open Fixed',
                                     Product_Passage__c='Drop Thru',
                                     Housing_Type__c='Rebuild',
                                     RecordTypeId='012G0000000qdfL',
                                     Make_Lookup__c=make.Id,
                                     Model_Lookup__c=model.Id,
                                     Housing_Assembly__c=hsasm.Id,
                                     Drive_Endcap_Assembly__c=ecasm.Id,
                                     Tail_Endcap_Assembly__c=ecasm.Id,
                                     Verified__c=true);
        insert prod;
        PricebookEntry PBE = new PricebookEntry(IsActive=true,
                                                UnitPrice=1000,
                                                UseStandardPrice=false,
                                                Pricebook2Id='01sG00000001zX0',
                                                Product2Id=prod.Id);
        insert PBE;
        Account acct = new Account(Name='Test Account',
                                   Type='Direct Customer',
                                   Shipping__c='Prepaid',
                                   Ship_Via__c='UTS',
                                   Sales_Discount__c=0);
        insert acct;
        Opportunity opp = new Opportunity(Name='12345',
                                          RA__c='12345',
                                          StageName='Quote Sent',
                                          CloseDate=System.today(),
                                          AccountId=acct.Id,
                                          Product__c=prod.Id,
                                          Make__c='Kice',
                                          Model__c='VJ 14x10x10',
                                          Max_Temp__c='120',
                                          Serial__c='N/A',
                                          Cold_Clr_Radial__c='.004-.007',
                                          Cold_Clr_Side__c='.004-.007');
        insert opp;
        Quote quote = new Quote(Name=opp.RA__c,
                                OpportunityId=opp.Id,
                                Pricebook2Id='01sG00000001zX0');
        insert quote;
        /*QuoteLineItem QLI = new QuoteLineItem(QuoteId=quote.Id,
                                              Product2Id=prod.Id,
                                              Quantity=1,
                                              PricebookEntryId=PBE.Id,
                                              UnitPrice=1000,
                                              Additional_Charges__c=0,
                                              Discounted_Amount__c=0,
                                              Core_Charge__c=0,
                                              Credit_Amount__c=0,
                                              Shipping_and_Handling__c=0,
                                              Rush_Charges__c=0);
        insert QLI; */
        
        
        Test.startTest();
        Production_Tracking_Record__c PTR = new Production_Tracking_Record__c(Name='12345',
                                                                              RA__c=opp.Id,
                                                                              Product__c=prod.Id,
                                                                              Housing_and_Endcaps_Order_Date__c=null,
                                                                              Shaft_Steps_on_Drive_End__c='1');
        insert PTR;
                  
        Test.stopTest();
        
        Production_Tracking_Record__c newptr = [ select id from Production_Tracking_Record__c where id =: BOM.custObj.Id];
        System.assertNotEquals('', BOM.custObj.Id, 'There is no ID');
        
        
    }
}
When I save there's not an error, but tests keep failing. If anyone could help, I'd greatly appreciate it! 
Hi All,

I am Stuck with selecting the pricebook for Opportunity based on user profile.
Scenario is: I have Custom Page to Add product to Opportunity(Add Line Item) page is accessed using list Button from product related list in Opportunity. What i need is Pricebook to Opportunity should be assigned automatically based on the user profile who is creating the Line item.

each profile having access to only one pricebook.
selection of Pricebook to Opportunity should happen in Apex code.

Please help on how can i query the to which pricebook the current profile who is access the page have access?

Thanks,
Ram
Hi

My scenario is :
Billing Document:Parent
Billing Item:Child
I need a detion trigger to delete Billing Item with Unit Price=0/Blank and Subsegment=Undefined.

Note:Billing document can also be created from SAP.So if any Billing Item with above mentioed criteria is there it should also get deleted
Thanks!!
I'm trying to integrate amazon with salesforce since day's but got stucked. Although i'm providing the correct "Access Key", "Security Key", "Token" etc, the error keeps on popping up.
Can anyone help me to figure out where i'm wrong?
List<AmazonMWS__c> amazonList = AmazonMWS__c.getall().values();
    	
    	//Current time in GMT ISO 8601
        String timestamp = datetime.now().formatGMT('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'');
        timestamp = EncodingUtil.urlEncode(timestamp,'UTF-8');
        
        //Amazon Variables
        String action = 'ListOrders';
        String version = '2013-09-01';
        String signatureVersion = '2';
        String signatureMethod = 'HmacSHA256';
        String marketplaceId= amazonList[0].Marketplace_ID__c;
        String marketplaceToken = amazonList[0].MWSAuthToken__c;
        String fulfillmentChannel = 'AFN';
        String sellerId = amazonList[0].Seller_ID__c;
        String endpoint = 'https://mws.amazonservices.com/Orders/2013-09-01';
        String accessKey = amazonList[0].AWSAccessKey__c;
        String amazonSecretKey = amazonList[0].Secret_Key__c;
        
        //Construct a query string with the query information
        String queryString = 'AWSAccessKeyId=' + accessKey + 
				            '&Action=' + action  +
				            '&SellerId=' + sellerId +
				            '&MWSAuthToken=' + marketplaceToken  +
				            '&SignatureVersion=' + signatureVersion  +
				            '&Timestamp=' + timestamp  +
				            '&Version=' + version +
				            '&SignatureMethod=' + signatureMethod  +
				            '&CreatedAfter=2016-09-28T18%3A30%3A00Z' +
				            '&MarketplaceId.Id.1=' + marketplaceId  ;
        
        String stringtoSign = 'POST' + '\n' +
				            'mws.amazonservices.com' + '\n' +
				            '/Orders/2013-09-01' + '\n' +
				            queryString;
        
        //Covert query string to signature using Amazon secret key as key
        Blob mac = Crypto.generateMac('HMacSHA256', blob.valueof(stringtoSign),blob.valueof(amazonSecretKey));
        String signature = EncodingUtil.base64Encode(mac);
        signature = EncodingUtil.urlEncode(signature,'UTF-8');

        system.debug('signature '+signature);
    	
    	HttpRequest req = new HttpRequest();    
        
        req.setEndpoint(endpoint +'?AWSAccessKeyId=' + accessKey +
			            '&Action=' + action +
			            '&SellerId=' + sellerId +
			            '&MWSAuthToken=' + marketplaceToken  +
			            '&SignatureVersion=2' +
			            '&Timestamp=' + timestamp +
			            '&Version=' + version+
			            '&Signature=' + signature +
			            '&SignatureMethod='+ signatureMethod+
			            '&CreatedAfter=2016-09-28T18%3A30%3A00Z' +
			            '&MarketplaceId.Id.1=' + marketplaceId);
        
       req.setMethod('POST');
       system.debug('req'+req);
       Http http = new Http();
       HttpResponse res = http.send(req);
       system.debug(res.getStatus());
       system.debug(res.getStatusCode());
       system.debug(res.getBody());

 
I have created a lookup field in Account and while creating a trigger i used this "Check__c" to create new instance of that particular lookup.
eg: Check__c obj = new Check__c();
But this error keeps poping up.

(Note: Due to restriction i'm unable to share the code or actual field and object name. And i had checked TONS on times that i had used double underscore while using the custom object)