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
salesforcedev.ax840salesforcedev.ax840 

s-control issue in changing URL

Hi,

There is changes to  instance . but the developers write code in s-control like this:

            var objOpp  = new sforce.SObject("Opportunity");
            objOpp.set("Id",C_OpportunityID);
            objOpp.set("Change_Type__c","New");
            objOpp.set("Change_Description__c", "New Contract");
            objOpp.set("Contract_User__c", Name );
            objOpp.set("Contract_User_Id__c", UserId );
            objOpp.set("Contract_URL__c","https://emea.salesforce.com/"+C_ContractID);

 

I want to get the Url what ever it is in browser if the instance changes. I tried with "/" by deleting https://emea.salesforce.com but in opportunity display the ural is showing http:///contractID ...

 

can anyone tell how to resolve it..

thank you.

*werewolf**werewolf*

Getting rid of the absolute URL is the right thing to do.  You probably mismatched the quotes when you tried it before.  So it should look like:

 

objOpp.set("Contract_URL__c","/"+C_ContractID);

skodisanaskodisana

Hi,

 

Unfortunately Currently there is no way to get the current browser URL.

You can use the Hierarchy Custom settings for URL and you can access this in your scontrol.

In the Hierarchy Custom settings define the Default Organization Level Value.

assign the different URL for Sandbox and Production.

 

Below is the sample code:

Custom Objects Name: URL__c

Field in Custom object: ULR_Sandbox__c

 

{!$Setup.URL__c.ULR_Sandbox__c}

 

Thanks,

Kodiana

 

salesforcedev.ax840salesforcedev.ax840

I tried same way  but the output on opportunity is like this : http:///C_ContractID 

C_ContractID is showing id which ever it get. any other advice please.

thank you,

rajesh

skodisanaskodisana

Even after trying with custom settings also?

If YES, Please put the alert for custom setting URL.

 

Thanks,

Kodisana

salesforcedev.ax840salesforcedev.ax840

where is need paste this {!$Setup.URL__c.ULR_Sandbox__c} . in objOpp.set({!$Setup.URL__c.ULR_Sandbox__c}) or any other way to declare it..

thank you,

rajesh

skodisanaskodisana

Please try as below mentioned

 

objOpp.set("Contract_URL__c","{!$Setup.URL__c.ULR_Sandbox__c}"+"/"+C_ContractID);

salesforcedev.ax840salesforcedev.ax840

I tried creating custom setting as you said but it gave error :

  • Object Name: The Custom Object Definition (Unique) Name can only contain alphanumeric characters, must begin with a letter, and must be unique.

what i need to do now.

 

skodisanaskodisana

In the Object Name field do not put any extra space.

Use _ where ever you are having Spaces and this should be unique.

 

Like: Sample_Object_Name

 

 

salesforcedev.ax840salesforcedev.ax840

he error i got while saving s-control:

Error: You referenced an unsupported field type called "Lookup" using the following field: URL_Sandbox__c