jen
08/10/2020, 3:34 PMMTNathan
08/10/2020, 3:39 PMform.insertField()
- the field you're inserting essentially inherits the field group of the location you're inserting it, if that makes sense. You may also be able to get the field group id by inspecting the page's html but personally I have only done that for tabs, not field groups.erictgrubaugh
08/10/2020, 3:41 PM<td>
containing the Field Group. The id
attribute will have the Field Group's script ID, prefixed with fg_
, e.g. fg_custpage_grp_prompt
erictgrubaugh
08/10/2020, 3:42 PMjen
08/10/2020, 3:44 PMform.insertField()
but it refuses to put it before nextfield
and it just puts it at the top.jen
08/10/2020, 3:44 PMjen
08/10/2020, 3:44 PMjen
08/10/2020, 3:44 PMMTNathan
08/10/2020, 3:49 PMnextfield
set up with 'Same Row as Previous' on your custom form setup? I think I've run into issues with that in the past.MTNathan
08/10/2020, 3:50 PMnextfield
not camel-case like every other option name?jen
08/10/2020, 3:50 PMjen
08/10/2020, 3:50 PMjen
08/10/2020, 3:51 PMjen
08/10/2020, 3:51 PMjen
08/10/2020, 3:52 PMvar button_field = context.form.addField({
id: 'custpage_buttons',
label: 'custpage_buttons',
type: serverWidget.FieldType.INLINEHTML
}).updateLayoutType({
layoutType: serverWidget.FieldLayoutType.OUTSIDE
}).updateBreakType({
breakType: serverWidget.FieldBreakType.STARTROW
}).defaultValue = button_html;
context.form.insertField(button_field, 'custrecord_results');
MTNathan
08/10/2020, 3:53 PMjen
08/10/2020, 3:53 PMjen
08/10/2020, 3:53 PMjen
08/10/2020, 3:54 PMMTNathan
08/10/2020, 3:54 PMjen
08/10/2020, 3:54 PMMTNathan
08/10/2020, 3:54 PMjen
08/10/2020, 3:56 PMMTNathan
08/10/2020, 3:56 PMbreakType
is causing that?jen
08/10/2020, 3:56 PMjen
08/10/2020, 3:56 PMjen
08/10/2020, 3:57 PMvar button_field = context.form.addField({
id: 'custpage_buttons',
label: 'custpage_buttons',
type: serverWidget.FieldType.INLINEHTML
}).defaultValue = button_html;
context.form.insertField(button_field, 'custrecord_results');
MTNathan
08/10/2020, 3:58 PMcustrecord_results
is the red text in your screenshot, that looks right to me. Maybe try using an object for the options instead of the ordered parameters?jen
08/10/2020, 4:00 PMjen
08/10/2020, 4:00 PMMTNathan
08/10/2020, 4:03 PMcustrecord_results
in front of your scripted field (using form.getField()
) and then insert your scripted field in front of custrecord_results
. It feels really clunky and there's probably a better way, but I've done that in the past to get a field to show up as the first/last in a field group when it was otherwise giving me trouble.MTNathan
08/10/2020, 4:03 PMjen
08/10/2020, 4:05 PMjen
08/10/2020, 4:05 PMjen
08/10/2020, 4:05 PMMTNathan
08/10/2020, 4:08 PMMTNathan
08/10/2020, 4:08 PMinsertField
should just work the way it says it does...jen
08/10/2020, 4:08 PMjen
08/10/2020, 4:09 PMjen
08/10/2020, 4:09 PMMTNathan
08/10/2020, 4:09 PMfieldId
if you're doing it client-side using context.currentRecord
, of course.jen
08/10/2020, 4:12 PMjen
08/10/2020, 4:12 PMMTNathan
08/10/2020, 4:13 PM