• Sirisha K
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 0
    Replies
Hi There,

I have configured a navigation menu in the lightning community builder  with few menu items and I want to hide one of these items dynamically for few users when they launch the community based on their access.

My community has a custom header component and each of the navigation menu item is a community page which in turn contain a custom lightning component.

My plan is to execute a js in the header lightning component controller in the init() function. I'm trying to fetch the id of the navigation menu item that i want to hide and add a css (display:none) dynamically.

But then, I'm not able get the reference of the menu-item component. I tried using document.getElementByClassName but I couldn't get the DOM of navigation menu in the header component in the header component.

Please let me know if anybody has any other thoughts around this and let me know if you need more details on my question.

Thanks for your time,
Sirisha
Can we have a DML statement before an asynchronous continuation callout? 
General workaround to insert a record before performing a callout is to insert the record asynchronously. 
But then, In this scenario since we are referring to the continuation callout that happens asynchronously this workaround doesn't work. 
Please suggest.

Thanks,
Sirisha kodi
Apex Continuation is causing "Unable to restore input value state - state value missing for component..."

This happens when a continuation callout is made on the action call of a command Button and conditionally a part of a VF page is refreshed. I can provide more details around this if required.

This looks like a known issue - https://success.salesforce.com/issues_view?id=a1p300000008YsYAAU
Could anyone please let me know if there's a workaround for this?

Thanks, Sirisha Kodi
We have enabled the Lightning connect and defined an External Data Source for Lightning Connect - Odata 2.0 Adapter and the External Object records are loaded from Informatica. The functionality basically displays all the external object records related to an Account (External object is related to Account - indirect lookup relationship), on the Account detail page as an inline VF page. When the external object records are queried, in the background a REST callout is made. So the Test class needs to use a Test.setMock() method to set a mock response. Here is the code snippet that I'm using:

 static testMethod void PositiveTestCase() {
// test user - currentUser
system.runAs(currentUser){

//Setup Test Data
//Mock response
String testResp = 'CUSTOMER_SALES_HISTORY__x:{DisplayUrl=TEST,CUSTOMER_SALES_HISTORY_IID__c=TEST,ExternalId=TEST,SAP_CUSTOMER_NUMBER__c = 0000001003, PRODUCT_LINE__c  = LINEA, PRODUCT_NAME__c =PRD1 PRODUCT_TYPE__c = TYPEA}, CUSTOMER_SALES_HISTORY__x:{DisplayUrl=TEST1,CUSTOMER_SALES_HISTORY_IID__c=TEST1,ExternalId=TEST1,SAP_CUSTOMER_NUMBER__c =1234, PRODUCT_LINE__c  = LINEA, PRODUCT_NAME__c =PRD2 PRODUCT_TYPE__c = TYPEB}';

//Test class that implements HttpCalloutMock and returns a reusable response
Test_ReusableMockResponse fakeResponse = new Test_ReusableMockResponse(200,'SUCCESS',testResp, null);

Test.setMock(HttpCalloutMock.class, fakeResponse);
Test.startTest();
//set the standard Controller to the test Account created
ApexPages.StandardController std = new ApexPages.StandardController(testAccount);
InlineOrderHistoryViewController controllerInstance = new InlineOrderHistoryViewController(std);
Test.stopTest();
}
}

 
For a straightforward - web service built on REST, this mock response approach should ideally work. Considering the mock response as the real time response received, the unit test case scenario should cover the code.
But in this case, the mock response is not considered as the real time response in the unit test method and all the subsequent lines of code aren't covered.
Also, the Test.setMock() does help in overcoming -' Test methods to not support the WebService Callout' error. So I'm totally convinced that I need to cover this the way we cover the code involving web service callouts.

Please let me know if you have a workaround for this

Thanks,
Sirisha Kodi