• Mike Jack
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 5
    Replies
Hi All,

We have trouble in accessing the Community in Mobile App (Salesforce for iOS & Salesforce for Android).We are using Partner Central experience template to build a community to be accessed in the Mobile App.

Below are different issues we are facing:
  1. When a Community user logins to the Mobile App by changing the server url to community url., they dont seem to be able to do anything at all inside the app. The menu has only Tasks tab and just able to see the their tasks. Unable to view the complete community as viewed in browser.
  2. When a Community user logins to the Mobile App by using a Custom domain (by providing Community url in custom domain)., they can able to view the complete community but when the Mobile App is closed and re-opened, they are asked to login again.
Is this something related to the Community templates used or any settings we are missing so that complete Community can be used in the Salesforce Mobile App.
Hi All,

It would be really great if you can help me in the below scenario.
We have a usecase where we are sending the link of Visuaforce page with some parameters embed (https://bxxxxxxx--dev--c.visualforce.com/apex/LeadAssignTimer?leadid=a0421000002xxxxB) in a sms and when a person clicks on the link, it should open in the Saleforce1 app in mobile. This is working perfectly when user logged in Salesforce1 as Platform user.
But when the same is tried using VF page link related to Community (https://dev-b*******dev.cs26.force.com/LeadAssignTimer?leadid=a0421000002xxxxB) by logged in as Community user in Saleforce1 app., it not redirecting to Salesforce1, rather opening in the browser. It shoul redirect to the Salesforce1 app where we can see the VF page in Community.

Thanks in advance.
Hi All,

I have usecase where we need to use Visualforce page Tab to display a Lead record details by passing Lead Id to url which is working fine in Classis view, but How to view in Lighning Experience?. See belowscreenshots.
Classic

User-added image
 
Hi All,

Can we create custom push notification in Salesforce using Apex Class or Trigger?
The use case is to popup the notification to a particular user when a Lead is assigned to that user. 
Can anyone share the sample reference code. Thanks in advance.
Hi All,

Is there any possibility to get Lead Conversion Mapping Fields in Apex ??
I am trying to customize the Lead Conversion Process as per our requirement and I need to get what all Lead fields are mapped to Account/Contact/Opportunity. 
Please let me know if it is possible by anychance. 
Thanks in advance..
Hi All,

I would like to know the exact use of  'Create Follow-Up Task' button in Task. I tried to find its exact usage but not a luck. 
Is there any dependency between the two Tasks from which Follow-Up task is created or its purpose is something different ?
Thanks in Advance for yor valuable answers.

Regards,
MJ
Hi All,

I am exploring on Single Sign-On settings and came across a requirement where a User can login to his/her Box Account with Salesforce credentials using Singl Sign-On.
I have completed TrailHead module Set Up Single Sign-On for Your Internal Users which teaches SSO where Salesforce is the Service Provider and  Axiom Heroku web app is Identity Provider, i.e., we can login to Salesforce from a Third-Party Identity Provider.
But where as in my requirement, Salesforce would be Identity Provider and Box.com would be Service Provider.
It would be really helpful if someone can guide me for the soution or provide any links or tips to acheive this.

Thanks in Advance,
MJ
Hi All,

I am integrating Salesforce with Box using HTTP Callouts and Box API Reference. I have written a Controller for a Visualforce page which displays Box Widget in the detail page. I am following this link and able to cover only 36% and getting an exception - System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out  and test is failed.

Here is the Controller:
global class BoxAccountFolderWidgetController {
    
    global string WidgetLink {set;
                              get
                              {
                                  return WLink;
                              }
                             }
    
    public string AccntId = ApexPages.currentPage().getParameters().get('id'); 
    public Account ac = [select id, name, RecordTypeId, Box_Folder_ID__c from Account where id=:AccntId];
    public string BoxFolderId = ac.Box_Folder_ID__c;
    
    public BoxRefreshToken__c BoxCS = [select id, RefreshToken__c, ClientId__c, ClientSecret__c from BoxRefreshToken__c limit 1];
    
    public string ClientId = BoxCS.ClientId__c;
    public string ClientSecret = BoxCS.ClientSecret__c;
    public string RefreshToken = BoxCS.RefreshToken__c;
    public string endPointURL='';
    public string AccessToken='';
    public string SharedLink='';
    public string WLink='';
    String Response ='';
    
    global BoxAccountFolderWidgetController(ApexPages.StandardController controller) 
    {
        
    }
    
    global void WidgetMethod()
    {
        system.debug('RefreshToken '+RefreshToken);
        //Getting Access Token and Refresh Token
        HttpRequest req = new HttpRequest();
        endpointURL = 'https://api.box.com/oauth2/token';
        req.setEndpoint(endPointURL);
        req.setMethod('POST');
        req.setHeader('Content-Type','application/x-www-form-urlencoded');
        req.setbody('grant_type=refresh_token'+
                    '&refresh_token='+RefreshToken+
                    '&client_id='+ClientId+
                    '&client_secret='+ClientSecret);
        req.setHeader('Accept','application/json');
        Http http = new Http();
        
        HTTPResponse res = http.send(req);
        Response=res.getBody();
        system.debug('Response '+Response);
        Integer statusCode=res.getStatusCode();
        
        // Parse JSON response to get AccessToken and RefreshToken values.
        JSONParser parser = JSON.createParser(Response);
        while(parser.nextToken() != null) 
        {
            if((parser.getCurrentToken() == JSONToken.FIELD_NAME))
            {
                String fieldName = parser.getText();
                parser.nextToken();
                if(fieldName == 'access_token') {
                    AccessToken = parser.getText();
                }
                if(fieldName == 'refresh_token') 
                {
                    RefreshToken = parser.getText();
                }
            }
        }
        system.debug('AccessToken '+AccessToken);
        system.debug('RefreshToken '+RefreshToken);
        
        //Creating Shared Link for the Folder
        HttpRequest req2 = new HttpRequest();
        endpointURL = 'https://api.box.com/2.0/folders/'+BoxFolderId;
        req2.setEndpoint(endpointURL);
        req2.setMethod('PUT');
        req2.setHeader('Content-Type','application/x-www-form-urlencoded');
        req2.setHeader('Accept','application/json');
        req2.setHeader('Authorization', 'Bearer ' +AccessToken);
        req2.setbody('{"shared_link": {"access": "open"}}');
        
        Http http2 = new Http();
        
        HTTPResponse res2 = http2.send(req2);
        String Response2=res2.getBody();
        system.debug('Response2 '+Response2);
        Integer statusCode2=res.getStatusCode();
        
        // Parse JSON response to get Shared Link values.
        JSONParser parser2 = JSON.createParser(Response2);
        while(parser2.nextToken() != null) 
        {
            if((parser2.getCurrentToken() == JSONToken.FIELD_NAME))
            {
                String fieldName = parser2.getText();
                parser2.nextToken();
                if(fieldName == 'shared_link')
                {
                    system.debug('Enter shared_link ');
                    while(parser2.nextToken() != null) 
                    {
                        if((parser2.getCurrentToken() == JSONToken.FIELD_NAME))
                        {
                            String fieldName1 = parser2.getText();
                            parser2.nextToken();
                            if(fieldName1 == 'url')
                            {
                                system.debug('Enter url '+parser2.getText());
                                SharedLink = parser2.getText();
                            }
                        }
                    }
                }
            }
        }
        
        String s = SharedLink.substringAfter('s/');
        system.debug('s '+s);
        WLink = 'https://app.box.com/embed_widget/s/'+s+'?view=list&sort=name&direction=ASC&theme=blue';
        
        if(RefreshToken != null)
        {
            BoxCS.RefreshToken__c = RefreshToken ;
            update BoxCS;
        }
    }  
}

Here is the VF Page:
<apex:page standardController="Account" extensions="BoxAccountFolderWidgetController" action="{!WidgetMethod}" >    
    
    <iframe src="{!WidgetLink}" width="1000" height="400" frameborder="0" ></iframe>
    
</apex:page>

Test Class for above Controller:
@isTest
public class Test_BoxAccountFolderWidgetController {
    
    public static testmethod void test1()
    {
        Account ac = New Account (name ='TestAccount', Box_Folder_Id__c = '8644998269');
        insert ac;
        
        
        Apexpages.StandardController sss = new Apexpages.StandardController(ac);
        apexpages.currentpage().getparameters().put('id' , ac.id);
        
        
        BoxRefreshToken__c BoxCS = new BoxRefreshToken__c ( RefreshToken__c = 'AJtikYVgIUhEsvgPPnfPMLBvrhCtB3RCQFGon8TdWdxboJ1wt4XLUAyglMuqeVqF',
                                                           ClientId__c ='pgevke65b3i6ujpqbfmhpeh0b2tx7o6r',
                                                           ClientSecret__c = 'mwKeNUq8VARg6wIwzfLI84h47SLnlmnp');
        insert BoxCS;
        
        
        
        Map<string,string> Headers = new Map<string,string>();
        Headers.put('Content-Type', 'application/x-www-form-urlencoded');
        
        SingleRequestMock fakeResp = new SingleRequestMock(200,
                                                                  'Complete',
                                                                  '{"access_token":"YUBoKdFFSoosuj2xurAa2vnXqm6pUypB","expires_in":4084,"restricted_to":[],"refresh_token":"dWEDG768lQhtbIECGuYT5i9DCoq7Sd61ousFUD6Mro9FP2oxDmbU6arGdo8lXGan","token_type":"bearer"}',
                                                                  Headers);
        
        Test.startTest();
        Map<string,string> Headers1 = new Map<string,string>();
        Headers1.put('Content-Type', 'application/x-www-form-urlencoded');
        Headers1.put('Authorization', 'Bearer kCEBaUaNAfqvMenkBflDgqF22pBd5Gka');
        String Body1= '{"shared_link": {"access": "open"}}';
        
        SingleRequestMock fakeResp1 = new SingleRequestMock(200,
                                                                   'Complete',
                                                                   Body1,
                                                                   Headers1);
        
        Map<String, HttpCalloutMock> endpoint2TestResp = new Map<String,HttpCalloutMock>();
        endpoint2TestResp.put('https://api.box.com/oauth2/token',fakeResp);
        endpoint2TestResp.put('https://api.box.com/2.0/folders',fakeResp1);
        
        HttpCalloutMock multiCalloutMock =
            new MultiRequestMock(endpoint2TestResp);
        
        Test.setMock(HttpCalloutMock.class, multiCalloutMock);
        BoxAccountFolderWidgetController abc = new BoxAccountFolderWidgetController(sss);
        abc.WidgetMethod(); 
        Test.stopTest();
        //System.assertEquals(/*check for expected results here...*/);
    }
}
Any Help is appreciated.

Best Regards,
MJ
 
Hi All,

I have created a Global Action and Published in the Chatter Layout. The Action Type of Global Action is Custom Visualforce. The VisualForce page consists of a button when clicked it perform an action to Post some text to the Chatter.
I can able to Post to the Chatter successfully but I have to reload the Window to see my Post. But the window should be automatically reloaded once the button is clicked to show the inserted Post.

Here is the Screenshot of the Chatter with Global Action which consists the VF Page:
User-added image
Here is the VF Page:
<apex:page controller="PracticeClass" >
    <script>
    function refreshPage(){ 
        
        window.location.reload();
    }
    </script>
    
    <apex:form >
        <div align="center" style="margin:100px auto" >
            <apex:inputTextarea  />
            <apex:commandButton value="PostToChatter" action="{!PostToChatter}" onclick="refreshPage()" />            
        </div>
    </apex:form>
</apex:page>

Here is the Controller:
public class PracticeClass {
    
    public void PostToChatter()
    {
        FeedItem post=new FeedItem();
        post.Body= 'Your Feed is Posted 12345';
        post.ParentId= '00528000001KZre';
        insert post;
    }
}

Thanks in Advance,
Mike J
Hi All,

I have created a Global Action and Published in the Chatter Layout. The Action Type of Global Action is Custom Visualforce. The VisualForce page consists of a button when clicked it perform an action to Post some text to the Chatter.
I can able to Post to the Chatter successfully but I have to reload the Window to see my Post. But the window should be automatically reloaded once the button is clicked to show the inserted Post.

Here is the Screenshot of the Chatter with Global Action which consists the VF Page:
User-added image
Here is the VF Page:
<apex:page controller="PracticeClass" >
    <script>
    function refreshPage(){ 
        
        window.location.reload();
    }
    </script>
    
    <apex:form >
        <div align="center" style="margin:100px auto" >
            <apex:inputTextarea  />
            <apex:commandButton value="PostToChatter" action="{!PostToChatter}" onclick="refreshPage()" />            
        </div>
    </apex:form>
</apex:page>

Here is the Controller:
public class PracticeClass {
    
    public void PostToChatter()
    {
        FeedItem post=new FeedItem();
        post.Body= 'Your Feed is Posted 12345';
        post.ParentId= '00528000001KZre';
        insert post;
    }
}

Thanks in Advance,
Mike J
Hi All,

Is there any possibility to get Lead Conversion Mapping Fields in Apex ??
I am trying to customize the Lead Conversion Process as per our requirement and I need to get what all Lead fields are mapped to Account/Contact/Opportunity. 
Please let me know if it is possible by anychance. 
Thanks in advance..
Hi All,

I am exploring on Single Sign-On settings and came across a requirement where a User can login to his/her Box Account with Salesforce credentials using Singl Sign-On.
I have completed TrailHead module Set Up Single Sign-On for Your Internal Users which teaches SSO where Salesforce is the Service Provider and  Axiom Heroku web app is Identity Provider, i.e., we can login to Salesforce from a Third-Party Identity Provider.
But where as in my requirement, Salesforce would be Identity Provider and Box.com would be Service Provider.
It would be really helpful if someone can guide me for the soution or provide any links or tips to acheive this.

Thanks in Advance,
MJ
Hi All,

I am integrating Salesforce with Box using HTTP Callouts and Box API Reference. I have written a Controller for a Visualforce page which displays Box Widget in the detail page. I am following this link and able to cover only 36% and getting an exception - System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out  and test is failed.

Here is the Controller:
global class BoxAccountFolderWidgetController {
    
    global string WidgetLink {set;
                              get
                              {
                                  return WLink;
                              }
                             }
    
    public string AccntId = ApexPages.currentPage().getParameters().get('id'); 
    public Account ac = [select id, name, RecordTypeId, Box_Folder_ID__c from Account where id=:AccntId];
    public string BoxFolderId = ac.Box_Folder_ID__c;
    
    public BoxRefreshToken__c BoxCS = [select id, RefreshToken__c, ClientId__c, ClientSecret__c from BoxRefreshToken__c limit 1];
    
    public string ClientId = BoxCS.ClientId__c;
    public string ClientSecret = BoxCS.ClientSecret__c;
    public string RefreshToken = BoxCS.RefreshToken__c;
    public string endPointURL='';
    public string AccessToken='';
    public string SharedLink='';
    public string WLink='';
    String Response ='';
    
    global BoxAccountFolderWidgetController(ApexPages.StandardController controller) 
    {
        
    }
    
    global void WidgetMethod()
    {
        system.debug('RefreshToken '+RefreshToken);
        //Getting Access Token and Refresh Token
        HttpRequest req = new HttpRequest();
        endpointURL = 'https://api.box.com/oauth2/token';
        req.setEndpoint(endPointURL);
        req.setMethod('POST');
        req.setHeader('Content-Type','application/x-www-form-urlencoded');
        req.setbody('grant_type=refresh_token'+
                    '&refresh_token='+RefreshToken+
                    '&client_id='+ClientId+
                    '&client_secret='+ClientSecret);
        req.setHeader('Accept','application/json');
        Http http = new Http();
        
        HTTPResponse res = http.send(req);
        Response=res.getBody();
        system.debug('Response '+Response);
        Integer statusCode=res.getStatusCode();
        
        // Parse JSON response to get AccessToken and RefreshToken values.
        JSONParser parser = JSON.createParser(Response);
        while(parser.nextToken() != null) 
        {
            if((parser.getCurrentToken() == JSONToken.FIELD_NAME))
            {
                String fieldName = parser.getText();
                parser.nextToken();
                if(fieldName == 'access_token') {
                    AccessToken = parser.getText();
                }
                if(fieldName == 'refresh_token') 
                {
                    RefreshToken = parser.getText();
                }
            }
        }
        system.debug('AccessToken '+AccessToken);
        system.debug('RefreshToken '+RefreshToken);
        
        //Creating Shared Link for the Folder
        HttpRequest req2 = new HttpRequest();
        endpointURL = 'https://api.box.com/2.0/folders/'+BoxFolderId;
        req2.setEndpoint(endpointURL);
        req2.setMethod('PUT');
        req2.setHeader('Content-Type','application/x-www-form-urlencoded');
        req2.setHeader('Accept','application/json');
        req2.setHeader('Authorization', 'Bearer ' +AccessToken);
        req2.setbody('{"shared_link": {"access": "open"}}');
        
        Http http2 = new Http();
        
        HTTPResponse res2 = http2.send(req2);
        String Response2=res2.getBody();
        system.debug('Response2 '+Response2);
        Integer statusCode2=res.getStatusCode();
        
        // Parse JSON response to get Shared Link values.
        JSONParser parser2 = JSON.createParser(Response2);
        while(parser2.nextToken() != null) 
        {
            if((parser2.getCurrentToken() == JSONToken.FIELD_NAME))
            {
                String fieldName = parser2.getText();
                parser2.nextToken();
                if(fieldName == 'shared_link')
                {
                    system.debug('Enter shared_link ');
                    while(parser2.nextToken() != null) 
                    {
                        if((parser2.getCurrentToken() == JSONToken.FIELD_NAME))
                        {
                            String fieldName1 = parser2.getText();
                            parser2.nextToken();
                            if(fieldName1 == 'url')
                            {
                                system.debug('Enter url '+parser2.getText());
                                SharedLink = parser2.getText();
                            }
                        }
                    }
                }
            }
        }
        
        String s = SharedLink.substringAfter('s/');
        system.debug('s '+s);
        WLink = 'https://app.box.com/embed_widget/s/'+s+'?view=list&sort=name&direction=ASC&theme=blue';
        
        if(RefreshToken != null)
        {
            BoxCS.RefreshToken__c = RefreshToken ;
            update BoxCS;
        }
    }  
}

Here is the VF Page:
<apex:page standardController="Account" extensions="BoxAccountFolderWidgetController" action="{!WidgetMethod}" >    
    
    <iframe src="{!WidgetLink}" width="1000" height="400" frameborder="0" ></iframe>
    
</apex:page>

Test Class for above Controller:
@isTest
public class Test_BoxAccountFolderWidgetController {
    
    public static testmethod void test1()
    {
        Account ac = New Account (name ='TestAccount', Box_Folder_Id__c = '8644998269');
        insert ac;
        
        
        Apexpages.StandardController sss = new Apexpages.StandardController(ac);
        apexpages.currentpage().getparameters().put('id' , ac.id);
        
        
        BoxRefreshToken__c BoxCS = new BoxRefreshToken__c ( RefreshToken__c = 'AJtikYVgIUhEsvgPPnfPMLBvrhCtB3RCQFGon8TdWdxboJ1wt4XLUAyglMuqeVqF',
                                                           ClientId__c ='pgevke65b3i6ujpqbfmhpeh0b2tx7o6r',
                                                           ClientSecret__c = 'mwKeNUq8VARg6wIwzfLI84h47SLnlmnp');
        insert BoxCS;
        
        
        
        Map<string,string> Headers = new Map<string,string>();
        Headers.put('Content-Type', 'application/x-www-form-urlencoded');
        
        SingleRequestMock fakeResp = new SingleRequestMock(200,
                                                                  'Complete',
                                                                  '{"access_token":"YUBoKdFFSoosuj2xurAa2vnXqm6pUypB","expires_in":4084,"restricted_to":[],"refresh_token":"dWEDG768lQhtbIECGuYT5i9DCoq7Sd61ousFUD6Mro9FP2oxDmbU6arGdo8lXGan","token_type":"bearer"}',
                                                                  Headers);
        
        Test.startTest();
        Map<string,string> Headers1 = new Map<string,string>();
        Headers1.put('Content-Type', 'application/x-www-form-urlencoded');
        Headers1.put('Authorization', 'Bearer kCEBaUaNAfqvMenkBflDgqF22pBd5Gka');
        String Body1= '{"shared_link": {"access": "open"}}';
        
        SingleRequestMock fakeResp1 = new SingleRequestMock(200,
                                                                   'Complete',
                                                                   Body1,
                                                                   Headers1);
        
        Map<String, HttpCalloutMock> endpoint2TestResp = new Map<String,HttpCalloutMock>();
        endpoint2TestResp.put('https://api.box.com/oauth2/token',fakeResp);
        endpoint2TestResp.put('https://api.box.com/2.0/folders',fakeResp1);
        
        HttpCalloutMock multiCalloutMock =
            new MultiRequestMock(endpoint2TestResp);
        
        Test.setMock(HttpCalloutMock.class, multiCalloutMock);
        BoxAccountFolderWidgetController abc = new BoxAccountFolderWidgetController(sss);
        abc.WidgetMethod(); 
        Test.stopTest();
        //System.assertEquals(/*check for expected results here...*/);
    }
}
Any Help is appreciated.

Best Regards,
MJ
 
Hi All,

I have created a Global Action and Published in the Chatter Layout. The Action Type of Global Action is Custom Visualforce. The VisualForce page consists of a button when clicked it perform an action to Post some text to the Chatter.
I can able to Post to the Chatter successfully but I have to reload the Window to see my Post. But the window should be automatically reloaded once the button is clicked to show the inserted Post.

Here is the Screenshot of the Chatter with Global Action which consists the VF Page:
User-added image
Here is the VF Page:
<apex:page controller="PracticeClass" >
    <script>
    function refreshPage(){ 
        
        window.location.reload();
    }
    </script>
    
    <apex:form >
        <div align="center" style="margin:100px auto" >
            <apex:inputTextarea  />
            <apex:commandButton value="PostToChatter" action="{!PostToChatter}" onclick="refreshPage()" />            
        </div>
    </apex:form>
</apex:page>

Here is the Controller:
public class PracticeClass {
    
    public void PostToChatter()
    {
        FeedItem post=new FeedItem();
        post.Body= 'Your Feed is Posted 12345';
        post.ParentId= '00528000001KZre';
        insert post;
    }
}

Thanks in Advance,
Mike J