Rest service class Is it possible to redirect to a record detailed page





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}






up vote
1
down vote

favorite












In the rest service class, Is it possible to redirect to a record detail page of a object using an record?(assume that the record will get in class) see below code



@RestResource(urlmapping = '/test/*')

global without sharing class test {

@HttpPost
global static String doPost() {

RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
Blob body = req.requestBody;

contact c = new contact();
c.lastname = 'Test';
insert c;
return null;
}


Is it possible to Redirect contact record detail page, please any one help on this.










share|improve this question






























    up vote
    1
    down vote

    favorite












    In the rest service class, Is it possible to redirect to a record detail page of a object using an record?(assume that the record will get in class) see below code



    @RestResource(urlmapping = '/test/*')

    global without sharing class test {

    @HttpPost
    global static String doPost() {

    RestRequest req = RestContext.request;
    RestResponse res = RestContext.response;
    Blob body = req.requestBody;

    contact c = new contact();
    c.lastname = 'Test';
    insert c;
    return null;
    }


    Is it possible to Redirect contact record detail page, please any one help on this.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      In the rest service class, Is it possible to redirect to a record detail page of a object using an record?(assume that the record will get in class) see below code



      @RestResource(urlmapping = '/test/*')

      global without sharing class test {

      @HttpPost
      global static String doPost() {

      RestRequest req = RestContext.request;
      RestResponse res = RestContext.response;
      Blob body = req.requestBody;

      contact c = new contact();
      c.lastname = 'Test';
      insert c;
      return null;
      }


      Is it possible to Redirect contact record detail page, please any one help on this.










      share|improve this question















      In the rest service class, Is it possible to redirect to a record detail page of a object using an record?(assume that the record will get in class) see below code



      @RestResource(urlmapping = '/test/*')

      global without sharing class test {

      @HttpPost
      global static String doPost() {

      RestRequest req = RestContext.request;
      RestResponse res = RestContext.response;
      Blob body = req.requestBody;

      contact c = new contact();
      c.lastname = 'Test';
      insert c;
      return null;
      }


      Is it possible to Redirect contact record detail page, please any one help on this.







      rest-api






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 18 at 9:41









      rahul gawale

      1339




      1339










      asked Nov 18 at 9:22









      Test userADG23

      246




      246






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          You can generate the link for your record and can use it for redirection. Try something like this in your code.



          String RecordId = c.Id;
          String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;


          To answer your question for the redirection to a record detail page little vague. You actually can't use the REST service to redirect to a page. All you can get from a service is a response. Response could be anything. If you are returning a link to a record detail page it will still be a response and the caller will decide if you have to redirect now or not.




          So by using above snippet you can generate a link but can't achieve a
          redirection directly. Its the caller's job not the service.







          share|improve this answer










          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @ sfdcLynx Thanks for your reply
            – Test userADG23
            Nov 18 at 10:12










          • let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
            – SFDCLearneR
            Nov 18 at 10:28












          • @ sfdcLynx please see above comment and reply me
            – Test userADG23
            Nov 18 at 10:29








          • 1




            @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
            – sfdcLynx
            Nov 18 at 10:37










          • @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
            – Test userADG23
            2 days ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239741%2frest-service-class-is-it-possible-to-redirect-to-a-record-detailed-page%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote



          accepted










          You can generate the link for your record and can use it for redirection. Try something like this in your code.



          String RecordId = c.Id;
          String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;


          To answer your question for the redirection to a record detail page little vague. You actually can't use the REST service to redirect to a page. All you can get from a service is a response. Response could be anything. If you are returning a link to a record detail page it will still be a response and the caller will decide if you have to redirect now or not.




          So by using above snippet you can generate a link but can't achieve a
          redirection directly. Its the caller's job not the service.







          share|improve this answer










          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @ sfdcLynx Thanks for your reply
            – Test userADG23
            Nov 18 at 10:12










          • let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
            – SFDCLearneR
            Nov 18 at 10:28












          • @ sfdcLynx please see above comment and reply me
            – Test userADG23
            Nov 18 at 10:29








          • 1




            @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
            – sfdcLynx
            Nov 18 at 10:37










          • @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
            – Test userADG23
            2 days ago















          up vote
          6
          down vote



          accepted










          You can generate the link for your record and can use it for redirection. Try something like this in your code.



          String RecordId = c.Id;
          String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;


          To answer your question for the redirection to a record detail page little vague. You actually can't use the REST service to redirect to a page. All you can get from a service is a response. Response could be anything. If you are returning a link to a record detail page it will still be a response and the caller will decide if you have to redirect now or not.




          So by using above snippet you can generate a link but can't achieve a
          redirection directly. Its the caller's job not the service.







          share|improve this answer










          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • @ sfdcLynx Thanks for your reply
            – Test userADG23
            Nov 18 at 10:12










          • let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
            – SFDCLearneR
            Nov 18 at 10:28












          • @ sfdcLynx please see above comment and reply me
            – Test userADG23
            Nov 18 at 10:29








          • 1




            @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
            – sfdcLynx
            Nov 18 at 10:37










          • @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
            – Test userADG23
            2 days ago













          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          You can generate the link for your record and can use it for redirection. Try something like this in your code.



          String RecordId = c.Id;
          String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;


          To answer your question for the redirection to a record detail page little vague. You actually can't use the REST service to redirect to a page. All you can get from a service is a response. Response could be anything. If you are returning a link to a record detail page it will still be a response and the caller will decide if you have to redirect now or not.




          So by using above snippet you can generate a link but can't achieve a
          redirection directly. Its the caller's job not the service.







          share|improve this answer










          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          You can generate the link for your record and can use it for redirection. Try something like this in your code.



          String RecordId = c.Id;
          String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;


          To answer your question for the redirection to a record detail page little vague. You actually can't use the REST service to redirect to a page. All you can get from a service is a response. Response could be anything. If you are returning a link to a record detail page it will still be a response and the caller will decide if you have to redirect now or not.




          So by using above snippet you can generate a link but can't achieve a
          redirection directly. Its the caller's job not the service.








          share|improve this answer










          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer








          edited Nov 18 at 10:15





















          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered Nov 18 at 9:59









          sfdcLynx

          1256




          1256




          New contributor




          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          sfdcLynx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • @ sfdcLynx Thanks for your reply
            – Test userADG23
            Nov 18 at 10:12










          • let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
            – SFDCLearneR
            Nov 18 at 10:28












          • @ sfdcLynx please see above comment and reply me
            – Test userADG23
            Nov 18 at 10:29








          • 1




            @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
            – sfdcLynx
            Nov 18 at 10:37










          • @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
            – Test userADG23
            2 days ago


















          • @ sfdcLynx Thanks for your reply
            – Test userADG23
            Nov 18 at 10:12










          • let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
            – SFDCLearneR
            Nov 18 at 10:28












          • @ sfdcLynx please see above comment and reply me
            – Test userADG23
            Nov 18 at 10:29








          • 1




            @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
            – sfdcLynx
            Nov 18 at 10:37










          • @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
            – Test userADG23
            2 days ago
















          @ sfdcLynx Thanks for your reply
          – Test userADG23
          Nov 18 at 10:12




          @ sfdcLynx Thanks for your reply
          – Test userADG23
          Nov 18 at 10:12












          let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
          – SFDCLearneR
          Nov 18 at 10:28






          let me explain clearly. I have implemented rest service and accessing API via force.com site and external system invoking this service with site URL. Whenever external system send the response with service URL we are creating or updating few objects. After execution is completed then it should be redirect to Opportunity or Contact Detail page. Any solution for this requirement? Please let me know on this.
          – SFDCLearneR
          Nov 18 at 10:28














          @ sfdcLynx please see above comment and reply me
          – Test userADG23
          Nov 18 at 10:29






          @ sfdcLynx please see above comment and reply me
          – Test userADG23
          Nov 18 at 10:29






          1




          1




          @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
          – sfdcLynx
          Nov 18 at 10:37




          @SFDCLearneR implementation will remain same. Your service in the force.com platform should generate a URL as I showed you above in the snippet. You can return this generated RecordLink as a response for your external system. And, once you received a response from service. You can redirect to that link. But the service can't do something like this that you update some records and then automatically redirected to some url. This is not possible with service or you can say not the function of any service.
          – sfdcLynx
          Nov 18 at 10:37












          @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
          – Test userADG23
          2 days ago




          @sfdcLynx Thank you for your help. I understand that we can't able to return to salesforce record detail page after DML operation in REST API. We can able to do this in SOAP API? Can you please let me know on this
          – Test userADG23
          2 days ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239741%2frest-service-class-is-it-possible-to-redirect-to-a-record-detailed-page%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre