I ask the developers because I think what I want will need code changes and I’m not too scared of that and am planning on it.
I have used Studio to create a custom field for accounts, it is a drop-down. I have been trying to add it to the create quote page as a viewable item. The challenge for me is editting the code such that when an account is chosen, it will auto-populate the custom field at the same time it auto-populates the address information.
So far as populating the field from an account to quote, I think I can edit the modules/AOS_Quotes/controller.php. But I would like it to auto-populate when choosing the account from a generic quote form like it does for the addresses.
Does anyone happen to know where I can start looking? I did find the javascript that generates the “sqs_objects” array javascript uses for getting the data from the database, but I can’t seem to find the code that generates that bit of javascript (My best guess is that it is generated by ViewSugarFieldCollection.php or SugarFieldParent.php, but can’t seem to find who invokes it for the page I’m interested in).
Any and all help is appreciated, I’ve been digging through this code for hours and not making as much progress as I would have hoped.
But I’m not looking to have the field auto-complete exactly. I’m looking to have the field populated on another form when an account is loaded via another field.
Any way, if you’re not looking for SQS… have you checked logic hooks?
You can have a logic hook be triggered by an event (typically a record being saved) and then do your logic and fill in some fields.
However if the event triggering this is not a record-level event, but something happening only in a field, you probably need to inject some Javascript into the view to do your magic.
Try Googling for “suitecrm inject javascript” you’ll find a few examples.
Thanks, I’ll take a look at that and see if it applies to what I am trying to do.
I am actually looking to add pricebook functionality to the quote module. I created a custom field in the accounts for a pricebook drop-down, then I am going to add a field for each pricebook discount to the products form.
My goal is to get the pricebook information from the account into the dropdown on the quote editview. Then I was going to edit line_item.js to ask for each of the pricebook discounts when it retrieves the product info. The java script would then look at the pricebook field that was copied in from the account and apply the proper discount to the line item.
Does this sound like a reasonable approach to this problem? My biggest hang-up has been getting the drop-down on the quote form to auto-set itself to the value stored in the account.
I appreciate your help thus far and am open to any pointers.
Quotes and line items are quite peculiar screens in SuiteCRM. They are one of a kind. They’re not a place where you can apply a generic view override.
So, although I am no expert in SuiteCRM customizations, I believe your approach is correct - that screen already has a lot of Javascript in lineitems.js, that’s probably the place to change things.