Default Value for custom fields

Hello Everyone,
I’ve got a little problem:
I’m trying to make a default value for a custom field but it’s not working correctly.

I’ve added this line of code:
$dictionary[“Account”][“fields”][“cagbp_general_business_posting_groups_accounts_1_name”][“default”]=“PAKICE”;

but still not working correctly. It’s displaying the value “PAKICE” but when i try to save it displays: [color=#ff0000]No match for field: General Business Posting Groups[/color] even that the value it’s in textfield.

Here is the screenshoot: https://imgur.com/a/kT0vD ,

You can see in the Picture that one field with name “VAT Business Posting Groups” has the default value “VENDOR” and for that field it’s working.
Is there any javascript file that I can make the default value ? If yes, can you tell me where can I change it.

Thanks for your time.

Meriton.

Have you tried doing it from Studio, instead of from code?

And you don’t mention where you made that dictionary definition (which file, in which folder, what else is in that file).

You can check out the Developer Guide to see where this should be done.

Hi,

your field is a related field, which means that you’d probably have to refer to the ID of the account to make this work.

You can find out the ID of the Account PAKICE by navigating to this account and look at the URL, it should be something like this:

http://.../index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DAccounts%26action%3DDetailView%26record%3D1061d7b9-8180-d5a6-87af-59f1f5a43745

Look at the end, where it says record%3D…

record%3D1061d7b9-8180-d5a6-87af-59f1f5a43745

You’ll need the part after the %3D which in this case would be

1061d7b9-8180-d5a6-87af-59f1f5a43745

Replace PAKICE with this ID like this:

dictionary["Account"]["fields"]["cagbp_general_business_posting_groups_accounts_1_name"]["default"]="1061d7b9-8180-d5a6-87af-59f1f5a43745";
1 Like

…/custom/Extension/modules/Accounts/Ext/Vardefs/cagbp_general_business_posting_groups_accounts_1_Accounts.php

in this file i made the dictionary definition.