• Chethan SN
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 8
    Replies
Hi All,
I am making a Rest API call which results in select query (filter) of a list view. This works in rest client as i am making a seperate calls for token and then actual data(with access token as header). 
But i am stuck in implementing the same in apex code. Please suggest where i am going wrong ? 
public class TestApex {
    @AuraEnabled
    public static void testMethod1(String str){
        try{              
            //testMethod1 tesM = new testMethod1();
            Object obj = JSON.deserializeUntyped(str);
            system.debug('Object :'+obj);
            /*************************************************************************************************************/    
            HttpRequest req = new HttpRequest();
            String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
            String filterId = '00B6A000002Fc2BUAS';
            //String filterId = '00B6A000002Fc0LUAS';
            String endPoinURL = baseUrl+'/services/data/v41.0/sobjects/Account/listviews/'+filterId+'/describe';            
            
            req.setEndpoint(endPoinURL);
            req.setHeader('Authorization', 'Bearer' + UserInfo.getSessionId());
            
            req.setMethod('GET');
            system.debug('UserInfo.getSessionId()' + UserInfo.getSessionId());
            //ID tempAuth= '**************************************************************************bGUyNIK.obuwcoY';            System.debug('UserInfo.getSessionId()'+UserInfo.getSessionId());
            //req.setHeader('Authorization', 'Bearer ' + tempAuth);
            Http http = new Http();
            HTTPResponse response = http.send(req);          
            // Map<String, Object> tokenResponse = (Map<String, Object>)          
            // JSON.deserializeUntyped(response.getBody());
            system.debug('Response'+JSON.deserializeUntyped(response.getBody()));
            /* String query = '';//(String) tokenResponse.get('query');

Map<String,String> columnData = new Map<String,String>();

for(String key : tokenResponse.keySet()){               
if(key.contains('columns')){
List<Object> colList = (List<Object>)tokenResponse.get(key);
for(Object obj : colList){
Map<String,Object> colMap = (Map<String,Object>)obj;
if(colMap.containsKey('hidden') && !(Boolean)colMap.get('hidden')){
columnData.put(String.valueOf(colMap.get('label')),String.valueOf(colMap.get('fieldNameOrPath')));
}
}
}   
}

for(String key : columnData.keySet()){
System.debug('Lable : '+key+' : Itag : '+columnData.get(key));
}

List<Account> accList = Database.query(query);
for(Account acc : accList){

}
*/
        }catch(Exception ex){
            System.debug('Line Number '+ex.getLineNumber());
            System.debug('Exception  '+ex.getMessage());
        }
    }
    
    @AuraEnabled
    public static String testMethod2(){
        try{
            system.debug('Inside testMethod2');
            HttpRequest req = new HttpRequest(); 
            String clientId = '3MVG982oBBDdw******************************************CO4g';
            String username = '*************';
            String password = '**********';
            String clientSecret = '353*********************9';
            // String loginUri = URL.getSalesforceBaseUrl().toExternalForm();
            //  String loginUri='https://test.salesforce.com/';
            req.setMethod('POST');
            // req.setEndpoint(loginUri+'/services/oauth2/token');
            req.setEndpoint('https://test.salesforce.com/services/oauth2/token');
            req.setBody('grant_type=password' +
                        '&client_id=' + clientId +
                        '&client_secret=' + clientSecret +
                        '&username=' + EncodingUtil.urlEncode(username, 'UTF-8') +
                        '&password=' + EncodingUtil.urlEncode(password, 'UTF-8'));
            
            Http http = new Http();
            
            HTTPResponse res = http.send(req);
            
           // testMethod1(res);
            System.debug('BODY: '+res.toString());
            System.debug('STATUS:'+res.getStatus());
            System.debug('STATUS_CODE:'+res.getStatusCode());
            String JsonString = JSON.serialize(res);
            testMethod1(JsonString);
             return JsonString;
            
        }catch(Exception ex){
            System.debug('Line Number '+ex.getLineNumber());
            System.debug('Exception  '+ex.getMessage());
            return null;
        }
    }
}
Hi All,
We have created a community using Napili template. We are not able to see the Asked questions under the topics. 
Steps we followed : 
Go to the community home page --> Click "Ask Question" Button --> Select Topic Name under "Post To"  --> Submit by clicking "Ask" Button.
oncew we navigate to the related topic on Menu Bar , we are unable to see the submitted questions under Disucussion tab in Search Results. I have checked the other available list views such as "Latest Posts" but no luck.
Please do suggest.

User-added image

User-added image
 
Hi All,
We have a visual force page with an action in apex:Page tag. This page is called on click of a quick action. This page is embedded as quick action for a custom object. I want to refresh the page once the action gets completed. Can anyone please give possible solution to this ? 

<apex:page extensions="WorkOrderComplete" sidebar="false" showHeader="false" action="{!WorkOrderCompleteAction}" StandardController="Work_Order__c">
</apex:page>

Thanks and Regards,
Chethan.S.N
 
Hi ,
I have implemented Digital signature using Visualforce pages and java script. It's working good in desktop and Ipad. I am facing problems in android devices. Can some one suggest the possible solution for this OR share thoughts/implementation using Lightning components please ? 

Regards,
Chethan.S.N
Hi ,
I am unable  to view a pdf file which is stored under Notes and Attachments of a custom object in our Community. 
Can some one suggest the possible solution please ? 
Hi , 
We have a community where we use Napili template. We have configured a custom object to display the records. When user navigates to any of the detail page of a record,if he/she clicks the back button on the device it causes to exit the application. User would be logged out and has to relogin for community access. This works fine in IPad as we do not hit back button there. Can someone suggest what we can do about this please? 
 
Hi,
we have an action button , a visual force page is referenced for this button. When you click this button a pop up is displayed. 
Desired Functionality : save button(action) also should be displayed.
Current working model : save button(action) is grayed out. Please refer this image. 
User-added image
This is working in another org . Since we have not written save or cancel button code in VF page i presume this is a standard functionality given on action button pop up.
Can someone please suggest what should be done? 

Thanks in advance.
Hi,
Every time a user registers through our community self registration a new contact in created. If we have a same email address already present in the system we would like to link the newly registered user to the existing contact . Can someone suggest how to resolve this ?
I have tried modifying the default controller but no luck. can we achieve this by modifying default self registration controller ? 

Thanks in Advance,
Chethan.S.N
Hi ,
We have a custom button on case object to create Work Order record(Custom object). Even though Work order record is created it shows up only after a multiple manual refreshes on the browser. Please do help in this regards.

Thanks in advance. 
Chethan.S.N
Hi ,
I have implemented Digital signature using Visualforce pages and java script. It's working good in desktop and Ipad. I am facing problems in android devices. Can some one suggest the possible solution for this OR share thoughts/implementation using Lightning components please ? 

Regards,
Chethan.S.N
Hi All,
We have created a community using Napili template. We are not able to see the Asked questions under the topics. 
Steps we followed : 
Go to the community home page --> Click "Ask Question" Button --> Select Topic Name under "Post To"  --> Submit by clicking "Ask" Button.
oncew we navigate to the related topic on Menu Bar , we are unable to see the submitted questions under Disucussion tab in Search Results. I have checked the other available list views such as "Latest Posts" but no luck.
Please do suggest.

User-added image

User-added image
 
Hi All,
We have a visual force page with an action in apex:Page tag. This page is called on click of a quick action. This page is embedded as quick action for a custom object. I want to refresh the page once the action gets completed. Can anyone please give possible solution to this ? 

<apex:page extensions="WorkOrderComplete" sidebar="false" showHeader="false" action="{!WorkOrderCompleteAction}" StandardController="Work_Order__c">
</apex:page>

Thanks and Regards,
Chethan.S.N
 
Hi ,
I am unable  to view a pdf file which is stored under Notes and Attachments of a custom object in our Community. 
Can some one suggest the possible solution please ? 
Hi All,

i have a standard opportunity page. also i have a field update on this. so i have to auto refresh my opportunity page when a field update happen. now i need to manully refresh the page. how can i achieve this. i have written a inline visual force page with a 'Reload' button embadded with the satndard page. but i need to manually click this button. i need the auto refresh the page.

Thanks,
Hi All,

I have created 'New Action' on Custom object 'class__C' and assign custom VF page in Action type. I need to handle Quick Action's Save button event in my custom visualforce page. The page pops up as a modal containing save button.
How to handle 'Save' button event of modal pop up in lightning experience?? 

User-added image
Hi All,

I have a requiremet to add digital signature to attachments, we have some apps like docu sign,..., but i don't want to use that apps , i want to do some cutomization to achieve this, please any one help on this.

Thanks,
Surya