Custom function to autofill the data in zoho crm across modules - zoho

I've two custom modules say A and B.
A module has some fields and B has some fields. Now I want to populate the fields from B module to A module which are common in both using a lookup field in my A module.
I've tried this . But this is only for default modules and not custom modules.
I want to write a function for a single case.
B module has a text field with label called b and A module also have a text field with label called b. I want to populate the text field value of A module with that of B module.

it's the same for all modules. case:1 IF you have One record for the custom module, you need to pass the API Name of that module. eg: CSATDetails = zoho.crm.getRecordById("CSAT",ccsat_id); CSAT=Custome module: find the API name of that Module. --> Setting--> API-->API Names-->Right side API Name ie Link Name. case:2 IF you have many records https://www.zoho.com/deluge/help/crm/get-related-records.html CSATDetails = zoho.crm.getRelatedRecords("relationName","ParentModule",ccsat_id);

Firstly You need to capture the ID for Form A which should be present in the lookup field in Form B, You can do this by using zoho.crm.getRecordByID() function.
After which you must create a map having the key value pair of api names of the fields and their appropriate values.
You need to pass the above mentioned map variable in zoho.crm.updateRecord() function call and that is all you need to do.

Related

Laravel validation; human names for array fields

In Laravel form validation you can do this: file_description.* to validate each item of an array according to a set of rules. The problem is, the system automatically returns "file_description.1 is required" as an error message if the field is required and not filled in.
More on that here: https://ericlbarnes.com/2015/04/04/laravel-array-validation/
Now, I'm not a complex man, I just want the field to say "File Description 1 is required". I am aware you can set messages but a) my input arrays are dynamically generated by jquery (click to add more type scenario) so I'd have to use a loop like in the above example b) I feel like there must be a better way.
Is there a way to either extend the core validation system to simply return a humanized name for the array field as Laravel does with regular fields, or is there an option I missed in the docs that allows for this? I'd rather not get involved with doing some regex type search to fix this.

Accessing Cognito Custom Attributes in a post-confirmation lambda function

I have a post-confirmation lambda function that writes user attribute information to a dynamoDB table. I've managed to get access to standard user attributes fields in the "event" parameter by doing stuff like
event.request.userAttributes.sub
but trying to run
event.request.userAttributes.role //where role is the name of my custom attribute
doesn't seem to work. Anyone know what the proper syntax for this is? And do I need to set any special read permissions for custom attributes? I created this custom attribute a long time after I originally made this user pool, if that changes things.
All custom attributes are prefixed with the custom: prefix (Documentation - Custom Attributes).
Therefore (I'll assume you're using JavaScript here- if not feel free to specify and I can change this example), you'd need to use:
event.request.userAttributes['custom:role']
You don't need to set any special read permissions- all the user attributes are returned in the PostConfirmation lambda.

Setting a fields default value to the result of some calculation

I have 2 entities, let's call them Parent and Child, with a 1:n relationship, where one Parent can have 0-n Child.
The Parent has two fields, Parent.Number and Parent.Name. When creating the Child via the plus button in a subgrid of Parent, the Child.Name should be preset to:
Child of Parent.Name (Parent.Number)
I've tried lots of different approaches wich all led to dead Ends. Some of them were:
Calculating via BusinessRules
Calculated Field on Child in combination with BusinessRules
Calculated Field on Parent, transferring the precalculated Text to the Child entity by Mapping.
Calculated Field on Parent, using a BusinessRule to set it's value as the default value of Child.Name
Using a workflow for Child.OnAfterCreate (works, need it in the OnFormLoad, though)
(For brevity I will not go into details of why each approach did not work, but will elaborate on request.)
Is there any way to achieve this without the use of Client side Scripting that I am not aware of?
Without using JavaScript (which is a solution) I can only suggest the following approaches (of which you can use some or all) which are all compromises really:
Change your requirement to make the name as shown below. A business rule on the child can then be used to populate this information. It can access the name but not any other field, i.e. number.
Child of Parent.Name
Use a quick view form to show the parent details on the child. This allows users to see the data even if the name is not set correctly.
Use one of the above, and the workflow. So the correct value is still finally set and you provide the user with as much information as possible until that point.
Remove the name field from the child form body. Use a workflow to set the value, when the form is saved. CRM displays names at the top of the form so it will appear as soon as they save but they wont see an empty field before that.
Change the name of the parent record to as shown below, you can then use that in business rules on the child.
Parent.Name (Parent.Number)

Opencart module controller index function data source

Some module controllers on a website I work with have data passed to their index function. How is it done? I can't find the source file that sends data to controller.
The $this->config->get object is set initially from index.php file as a current setting and not as a module tracking. The $setting array passed into the index method is the one initialized whenever the current module is loaded at that point in the loop. The $setting object should be initialized automatically by ensuring that the same basic key names are being added from the admin modules before loading the array on the store-front end. Additional key names can be added along with the basic key names as there should be no problem to re-catch those additional keys by using the $setting array either. This methodology should not interfere with other modules nor with other basic key names since each $setting array are being fetched accordingly from the database.
You can also check module table in your opencart database to understand it more clearly.
Source Link

I would like to define a component as optionally required (based on another field's value)

I built two custom components using built-in CQ components. The components' JSP's, along with some custom javascript, have a line like below in order to leverage the built-in components (and their formatting, labels, etc.).
<cq:include path="." resourceType="foundation/components/form/dropdown" />
I have one each of my custom dropdown components on a form. I can mark field A and field B as both being required in their respective components' editor dialog. I can provide required messages so that when either field is blank and the form is submitted, I get a message that the fields are required (with my custom messages). However, what I really want to do is hide or disable field B based on the value supplied in field A. I'm handling this manually via jQuery. However, this of course presents a problem on validation. I want field B to be NOT required when it is hidden/disabled and for it to be required when it is enabled/visible. Since the showing/hiding is done client-side, the server-side validation has know knowledge of the change and still expect a value to be provided for field B.
I'm been trying to poke around in the CQ Widgets API to find if there is something I can do on the client side to set/unset the required property so that when the form gets posted it is handled correctly. I'm guessing that there isn't since the validation seems to be happening on post instead of client-side.
Any ideas/thoughts/options?
It turns out that the link from my comment gave me the idea that I can have custom server-side validation for my form, I just wasn't sure how to connect it to the field. It turns out that all I had to do was create a servervalidation.jsp file in my "B" component. CQ will see the servervalidation.jsp and automatically invoke it for my custom component.
I was then able to examine the submitted value of field "A" (by getting the parameter from the request object) and doing some other custom logic for my needs.
I was then able to optionally do this:
FieldDescription field = FieldHelper.getConstraintFieldDescription(slingRequest);
FieldHelper.checkRequired(slingRequest, field);

Resources