In ADF 11g ApplicationModule error while submitting form - oracle-adf

1.after inserting a record in db properly ,im trying to insert another record(after clicking save button ) but it giving on error like ,"
Attribute DoctorId in AppModule.DoctorEOView1 is required" ,and its why its giving how can i solve it
2.i like to get a attribut value from db and show this attribute value increment by one in ui ,in empty form as default value
how to do it in ADF 11 g

1 - this is because your DoctorId is empty and marked as requiered.
2 - read about the DBSequence data type in ADF BC.
More:
https://pinboard.in/search/u:OracleADF?query=DBSequence

Related

React Admin - CloneButton - exclude id

I have used the 'clonebutton' from react-admin which will allow me to clone/copy the existing data record into another one and will open the edit form. But It clone all fields , i just want to exclude the id field else i've got an error :
{"name":"Conflict","message":"id: value already exists.","code":409,"className":"conflict","errors":{"id":"value"}}
How can I do it?

multi-select dropdown and form field shows as array?

I am using ColdFusion 2016. I have a form with a multi-select drop down. The name attribute of the field is called jobRoleId. When I submit this form the field name is available in the form scope as jobRoleId[]. How do I get the value of this field? The name comes across like an array but I can't seem to just dump out the value due to the brackets.
I've tried dumping out the value, but I get an error. I feel like I have done this in the past and the form field name didn't contain the brackets [] after the field name when using a multi select menu:
<select id="jobRoleId" name="jobRoleId" multiple="multiple">...</select>
Is there a way to somehow have the form field name just come across as jobRoleId?
writedump(jobRoleId[]);
abort;
When I execute your code I get a comma separated list for the values of jobRoleId. Are you using any CF frameworks?
My output:
I also suggest looking at the client side JavaScript to confirm there's nothing changing the submitted name. You can use the Chrome/Firefox/IE debugger to watch your submissions and confirm what is being submitted
Multi select lists, in CF, should return a list of values, as far as I remember...

Trying to clear ApexPages.Messages Container

I apologize for the long winded question.
Context:
We have a mapping that basically maps a field from one object to a field on another object. Object_A to Object_B. In the trigger of Object A we look to see if there is a mapping to object B. If so, we load object b record and copy the value from the specific field in A to the field in B. After we've made all the copies we update B.
We have a try catch around the update to B to catch any exceptions. The issue we are facing is that an exception is thrown from a Salesforce validation, not a custom validation rule and creates messages automatically. For example someone entered 123.45, and the field in object b that it's attempting to transfer to is formatted as a 2.0 number. That will generate a DML exception for invalid range. Which is fine. The problem is that Salesforce is also adding an error to the apexPages.Messages container. So if we have an on the page it will display the Salesforce error.
There's 2 problems with this.
1. The message is not really user friendly.
2. The message contains the field label of the field on object B not the field on object A. The user in this context will have no idea what that field is and with potentially 100 fields on the page that they have filled out, they might not be able to track it down.
I would much rather SF didn't add the message automatically, allowing me to catch the exception and format a message. But I don't see anyway to either stop SF from creating the message or clearing out the messages container so that we can add our own.
Is there a way to either stop Salesforce from automatically adding the message or to clear the apexPage.Messages without refreshing the page?
edited to show a quick example code:
list<Contact> contacts = [Select id,Email from Contact where id='someSFId'];
contacts[0].email = 'badEmail';
try{
update contacts;
}
catch(Exception ex)
{
System.debug(Apexpages.hasMessage());
}
You'll see the results of the debug will be true even though I've not added a message.
Hope this helps any.
List<ApexPages.Message> msgs = ApexPages.getMessages();
for(ApexPages.Message message : msgs ){
// get the object A field label from maaping
// construct custom error message/ replace field label string
}
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_apexpages.htm

angular form validation error shows [null]

I can't find out where is the error in my form.
I have a select of two items and an input for each of them.
When I choose one of the items my form myform.$error shows {"myform":[null]} when I input some variable it show {} - my form is good.
I can't find what does this expression mean: {"myform":[null]}

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.

Resources