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
Nihar SharmaNihar Sharma 

URL hack is not working for Standard Quote Object Using custom button (Visualforce page)

Hi Experts,

Here i have one issue, i am not able to create new Quote record from custom commandButton which i declared in Visualforce page..

i do not want to predefined Opportunity from Lookup field..
What i want is when i click on Create New Quote Button (custom button from VF Page) then only allow me to create new Quote and at that i am going to select Opportunity manually from the lookup field.

Hope this is clear !!

Let me show you the URL which i am using in action of commandButton
 
<apex:commandButton value="Create New Quote" action="/0Q0/e?retURL=%2F0063600000D5oyO&oppid=0063600000D5oyO"/>

Now, What should i do to replace OpportunityID which is passed twice in above URL ?

Please Help !!

Thanks
Best Answer chosen by Nihar Sharma
Bharath K 4Bharath K 4
Hi Nihar,

You will have to provide the Id of the Opportunity since Opportunity and Quote is a Master-detail relationship.
You cannot make the opportunity to be blank.

All Answers

Bharath K 4Bharath K 4
Try removing the section "&oppid=0063600000D5oyO" from the retURL attribute and check whether the Opportunity becomes blank.
Nihar SharmaNihar Sharma
Hi Bharath,

tried it and code seems like 
<apex:commandButton value="Create New Quote" action="/0Q0/e?retURL=%2F0063600000D5oyO" />

but Got the following error

"Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors."
Bharath K 4Bharath K 4
Hi Nihar,

Please try the below in your code.

<apex:commandButton value="Create New Quote" action="/0Q0/e?retURL=%2F0063600000D5oyO&oppid="/>

 
Nihar SharmaNihar Sharma
Bharath,

See below image i tried your updated code but getting the following output:

User-added image

Error like :

User-added image
Bharath K 4Bharath K 4
Hi Nihar,

You will have to provide the Id of the Opportunity since Opportunity and Quote is a Master-detail relationship.
You cannot make the opportunity to be blank.
This was selected as the best answer
Nihar SharmaNihar Sharma
Ok. Got it.

if this relationship is LookUp then we can leave it blank..right ?

 
Bharath K 4Bharath K 4
Yes ofcourse, that's right.
Bharath K 4Bharath K 4
And also I found that the standard Opportunity name cannot be removed from layout.
Nihar SharmaNihar Sharma
Thank you Bharath...:)
Nihar SharmaNihar Sharma
Yeah That's true..

Cheers !!