function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arnav Ray 1Arnav Ray 1 

Opening a contact record on invoking rest api.....???????

Hi all,

I have requirement where I have to open a contact record after invoking the rest api but before returning the response.

My rest api class is:-
@RestResource(urlMapping='/Account/*')
global with sharing class RESTAgentController {

 @HttpPost
    global static String doPost(String customerId,String cus_context,String ContactNo) 
    {
        String customer_Id= customerId;
        String context= cus_context;
        String cus_ContactNo= ContactNo;       
        String agent_num='434343434';
        return agent_num;
    }    
}

The vf and the controller for opening the contact record are:-

Visualforce Page:-
<apex:page Controller="autoContactController" action="{!redirect}" > </apex:page>

Apex controller:-

public with sharing class autoContactController{
    
    public PageReference redirect() { 
        String phone = ApexPages.currentPage().getParameters().get('phone');
        String contactId = '0032800000ZW42T';
        PageReference pr = new PageReference('https://ap2.salesforce.com/console#%2F'+contactId);
        return pr; 
    }
}

Can anyone please help??????
Arnav Ray 1Arnav Ray 1
Its urgent please....!!!!!!!!!!!!!!
 
SFDC coderSFDC coder
@Arnav Ray 1 : At which line are you invoking your webservice from controller?