Set opportunity amount filed value as default value in related object field - salesforce

I have a custom object FlightRequest for Opportunity object and there is an Amount filed both in opportunity and FlightRequest.
I want to set Opportunity's Amount filed value as default in FlightRequest's Amount Field. So whenever New Button clicked for FlightRequest, Amount input should already field with Opportunity's Amount
I m using Standard page layout not any visual force page layout and can not use it.
I saw there is an option to set default value for a field but Opportunity object is not shown in Select Field Type options
please advice how can i accomplish this
thanks in advance

This is possible with a "unofficially" supported technique (meaning everyone has been doing it for 10 yrs and while they say it's unsupported they'll never break it, too many customers use it) called URL hacking. Basically when they click the new button you'll pass the value for your field into the new record page dynamically based on the parent record. There is a good blog post tutorial on this. Give it a try and that should do what you need.

You need to set up a Master-Detail relationship between the objects, then you can setup the Amount field on the FlightRequest object as a formula field that references the Amount field on the Opportunity.
This should accomplish what you need to do. The Master-Detail relationship is essential for the cross-object reference of fields.

Related

An Updated Salesforce's Picklist does'nt render a new value just added

I am new in Salesforce and I need to add a new value in a picklist. Once added, I save, but when a I need to create a new record of the object within which there is the picklist, the new value is not rendered. Someone can explain me why?? Thanks
I tried by adding the new value by editing the picklist.
Does your object have "record types"? Like "ok, all accounts go to 1 database table but hospitals/factories/marketing agencies need different fields visible, different rules around what is required and even if they use same picklists - values on the picklists may differ". When you were adding that new picklist value it probably asked you to which (if any) record types you want it added...
Firstly, you should make sure the picklist value is active. Then make sure that the user profile viewing the page has visibility to that record type. this can be checked under Profile > Object settings > Work Order (or object that applies). After checking make sure that picklist field value was added to the appropriate record type.Please give feedback if u managed to get this done.

Salesforce Screen flow search and display record information

I'm working on a screen flow. The idea is to have a lookup component the user can search a contact. Then I would like to display the information from the Contact (Account Name, Contact Name, Number Email) and I would like to be able to have the user update that information if needed. I just stomped on how it can be done. I know it should be able to be pulled from the record ID in some type of way and maybe use an Assignment to display the information. Can someone guide me on a next step or if anyone has an instructional video would be helpful.
Thanks
You wouldn't be able to display the looked up contact's fields on that screen as soon as you populate that field. That would be something only possible in code (aura component or lwc).
What you can do, however is -
Get Record element after that screen element. (Get Contact, where Id = lookupcomponent.recordId)
Then EITHER:
use the new Fields (BETA) option on another screen Fields (BETA)
(this method is easier, doesn't have as much control and is limited on fields, depending on data type, you can use)
add inputs one by one and set the default values Add Fields One By One
(this method allows more control)
Then, you will need an update element. If you used the Fields (BETA) you can just update the record variable. If you did the inputs one by one, you will need to update the contact and set fields individually.
Full Flow Example

How do I get the SalesForce record id in a custom field

I wanted to add a simple read-only URL-field to 'opportunities' in SalesForce that contains a link to an external webpage with the 15-char record id (used in the salesforce urls) attached to it . To do this I wen to /ui/setup/Setup?setupid=Opportunity --> fields and created a new field under 'Opportunity Custom Fields & Relationships'.
I chose a field with data type 'URL' and added a default value. I thought
"http://example.com/?sfid="&id would do the trick, but this returns
Error: Field id may not be used in this type of formula
This is a vague error. Is my syntax of a default value wrong, or am i using the 'id' parameter in a wrong way? And what is the right way to do this?
I'm new to SalesForce, as you probably already have guessed.
As the other answer stated - Id will be known only after insert meaning the "default value" trick won't work for you.
You have some other options though:
Workflow rule that would be populating the URL field after save.
Formula field of type text that uses HYPERLINK function
HYPERLINK("http://example.com/?sfid=" & Id , "See " & Name & " in ext. system")
Custom link (similar to custom buttons, they appear on the bottom of the page layout. Search them in online help)
The difference between 2 and 3 is quite minor. Custom links can appear only on the record's detail view while formula fields & other urls are well... fields - so they can be used in reports, listviews etc.
You'd have to decide which version suits you best.
This is a great question. You're right, the error is very vague.
To begin with, read some of the documentation on default fields. Pay particular attention to the order of operations:
The user chooses to create a new record.
Default field value is executed.
Salesforce displays the edit page with the default field value pre-populated.
The user enters the fields for the new record.
The user saves the new record.
Default field values are calculated before any other record data including the id are available. For this reason, they cannot be calculated based on other record fields. Especially the record id, which has not yet been assigned.
To get this functionality, you will need to create a workflow rule that fires on record creation and inserts the proper value into your field.
It would be nice if we could have formula URL fields, but we don't. EDIT: I am dumb and forgot about using HYPERLINK in text formula fields, as eyescream correctly points out.

How do I display an input field for Users, in a visualforce page?

I simply want to display an input field, that will let me capture a user, so I can filter a list from a custom object by owner. CustomObject__c.OwnerId is not writable, so when I bind it to an input field, nothing is displayed on my page! I don't want to have a drop down list of users (There could be hundreds!) and I don't want to create a spurious custom object with a writeable field, related to the User object. How can I get the input field functionality for a read only field, as if it were writeable?
OwnerId field should be writeable. Unless your field security permissions are messed up or for example the field is hidden because it's a detail in Master-Detail relationship.
But when you'll manage to get it to work you'll see that most likely it's a bit weird lookup that can point to User or Queue.
If you're fine with that - great, just check the security around the field. If you need really only a lookup to user - check if you have any custom Lookup(User) field? You could create a dummy record of that type in the controller and don't do any DML with it, just use the fact it'll have the lookup.
If you don't have any custom ones - I think that Account / Contact / Opportunity owner must be a user (can't have queues). You might have to force <apex:input field... required="false"/> but other than that it should OK?

How can I get the ID of a record when it isn't mentioned on a form in Access 2007 via VBA?

I have a multiple items form which does not mention the ID of the record. I have a button for each row which, when clicked, opens up a new form containing more details.
In the past, I've added a field for the ID but made it invisible, but this seems silly - the ID is a unique field of the original query, so I should be able to access purely with code somehow.
Does anybody know how to do this? Let me know if you want more clarification.
Update
The fastest way for me to do this is to add a field in the form for the field in the query, call it the query field name, save it all and close it, then delete the field. Though of course I'd rather just be able to do Me.ID without any of that prior nonsense.
In some cases, you may have to refer to Me!ID, rather than Me.ID because the field has not been added as a property of the form (discussion: http://tek-tips.com/viewthread.cfm?qid=1127364 )
When you add the ID as as control and then delete it, it becomes a property of the form, which is why your work-around works.
If a form's record source includes a field named "ID", you can access the field's value as a property of the form:
Debug.Print Me.ID
That works without a control bound to the field.
you probably need to edit the recordsource / query.. and add that column as an available field.

Resources