Salesforce.com - Custom mini page layout for new Line Item out of price book - salesforce

I need to programmatically select the fields or values that are shown when I add a line item to an opportunity.
I.E.
If I add a new item of type "A", in the mini page layout, I need to show Fields "X", "Y", "Z". If I add a new item of type "B", in the mini page layout, I need to show fields "X", "Z".
I'm kind of Salesforce newbie. I don't know where to even start. Just a link to the area of documentation that would explain this would be very helpful.

So if I understand correctly, you want the line item related list to show different fields on a row according to a certain field on the line item?
I can't think of anyway to do this with standard functionality, leaving two options I can think of:
Create a custom visualforce page and generated the related list yourself, you can then display different details for each row as it'll be 100% custom — since you're new to the platform I doubt this is will be a particularly viable option.
Use formula fields on the line item to display different values based on the type of a line, then expose these formula fields on the related list.
For example, Forumla_Field_1__c might will use the CASE() function to switch it's output based on one of the fields:
CASE(Type__c, 'A', Field_X__c, 'B' Field_Y__c);
Of course this won't allow you to display a different number of fields on each row, but it will let you see the values you want.
If I've misunderstood, and all line items on a given opportunity will be of the same type, then you'll want to use record types on the opportunity itself, then you can have a different page layout for each record type, and as such, different fields displayed on the related list.

Related

Salesforce Screen flow search and display record information

I'm working on a screen flow. The idea is to have a lookup component the user can search a contact. Then I would like to display the information from the Contact (Account Name, Contact Name, Number Email) and I would like to be able to have the user update that information if needed. I just stomped on how it can be done. I know it should be able to be pulled from the record ID in some type of way and maybe use an Assignment to display the information. Can someone guide me on a next step or if anyone has an instructional video would be helpful.
Thanks
You wouldn't be able to display the looked up contact's fields on that screen as soon as you populate that field. That would be something only possible in code (aura component or lwc).
What you can do, however is -
Get Record element after that screen element. (Get Contact, where Id = lookupcomponent.recordId)
Then EITHER:
use the new Fields (BETA) option on another screen Fields (BETA)
(this method is easier, doesn't have as much control and is limited on fields, depending on data type, you can use)
add inputs one by one and set the default values Add Fields One By One
(this method allows more control)
Then, you will need an update element. If you used the Fields (BETA) you can just update the record variable. If you did the inputs one by one, you will need to update the contact and set fields individually.
Full Flow Example

Dataview List and items

I am looking at a different way of doing my application.
Actually It's kind of static. My Projects have Categories. Each Category has Subcategories. Categories are containers and Subcategories are element which have values that can be edited.
After analysis of the data , we saw that it was not enough general for it. We are now looking at a Tree Structure. Doing so, we would have Projects filled with Folders/Categories) and those Folders would be filled with other Category/Folders or with SubCategories/Items/Files. That way we can go has deep has we want in complexity.
That is doable, I know it. What I need to know is how hard it will be to implement it in the app.views...
Is it possible to have a single Ext.DataView.dataview display different Ext.DataView.component.DataItem side by side.
Exemple : Having a row in my List that shows a slider and update itself according to it, but that on the 2nd row it is an arrow that on click would open the next level of my Tree.
Visual:
DataView_List
Small Car---------------------------Label------------------------SLIDER
Fuel----------------------------------Label------------------------------ >
SUV----------------------------------Label------------------------TxtField
Small Car and SUV are leaves with different template and Fuel is a category/folder that need to open on click.
So I already have 3 differents templates that would need to show in the same dataview list.
How should I proceed to achieve such results? Is Dataview List the way to good or should I implement my own kind of list inside a container?
If you want to present different kinds of data inside one list or dataview - you can achieve by following strategy:
You still need to use one store to keep it all
In the model class include something like 'record_type' field indicating what kind of data you have
Combine all data you need into one model
Create a template that based on the 'record_type' would render different content
Here is how your template would look like:
<tpl switch="record_type">
<tpl case="car">
<div>CAR + SLIDER</div>
<tpl case="fuel">
<div>FUEL + LABEL</div>
<tpl default">
</tpl>
This is screenshot from my list which contains multiple record types and uses this approach:

When creating a Drupal 7 content type programmatically, is there a way to add tuples of fields?

In Drupal 7, I'd like to create a Person content type. A person may have multiple profiles - an administrator should be able to select which profile will be considered the primary one. So, that means that I need a tuple consisting of:
A textarea, for the profile text
A checkbox, indicating that this is the primary profile
A textbox, for naming this particular profile
I need functionality to behave like that of any of the lists: I can click "Add another Item", and a set of all three of these fields will appear.
I have a vague idea of how this can be executed, but it involves using the form API to add fields before the form renders each time, as well as the necessary AJAX behavior. This seems a bit overcomplicated, since this would also necessitate creating an additional DB table to hold these tacked-on fields.
Is there a relatively simple way of doing this solely through hook_install()?
You can use drupal.org/project/profile2 or you can complete it using standard Drupal functionality, i.e. create a content type named, let's say, 'myprofile' and add all the fields use need. Then add a nodereferece (http://drupal.org/project/references) field to the user standard profie that would point to your 'myprofile' content type.
So all the 'myprofile' content, created by that user would be his profiles and the one pointed in his standard profile will be his default.
I hope it's clear enough )

Counting instances of a parameter value on an access form

I'd like to display, in the form footer of a Microsoft Access form, a count of a particular value of a field ("Category") I have tried using
=Sum(IIf([Category]="S",1,0))
as the control source for the text control in the footer, but this fails. I cannot figure out why I cannot perform this calculation on this control/field combination. I suspect it has to do with "Category" not being the control source for any control, even though it's available in the second column of my combo box.
I have performed the count on the "Appliance" field instead, and the sum function works correctly, So I'm pretty sure my general syntax and references aren't completely broken. Both underlying values are text fields.
I'd love some help with how I can get to the second parameter of the query with the Sum function?
Specifics:
ComboBox
Name is "lstAppliance". Bound Column: 1 , Row source :
SELECT qryApplianceDetails.Appliance, qryApplianceDetails.Category FROM qryApplianceDetails;
Text Box
Name is "txtCategory" , Control Source:
=Appliance.Column(1)
In case this isn't clear enough, what I'd like to see looks something like this:
Form header:
Appliance , Category
Form detail
Truck , S
Truck , L
Car , S
Bike , M
House, L
Planet , S
Form footer
Number of "S" things: 3
With this source in the footer:
=Sum(IIf([Appliance]="Truck",1,0))
Displays "2", as you would expect, but:
=Sum(IIf([Category]="S",1,0))
Displays "#error", instead of "3" as I'd expected.
I would try something simpler, but not sure if this will be too simple for what you need.
Use this expression as the control source for txtCategory:
=DCount("*", "qryApplianceDetails", "Category='S'")
Then in the form's On Current and After Update events, add this:
Me.txtCategory.Requery
In regard to the issue of using a field in the form's recordsource in an expression (or in VBA code), since A2000, things have become more difficult. It's not reliable if the field you're using has not been used as the ControlSource of a control on your form. The workaround is to create an invisible control with the field as its ControlSource.
Another way of working around that problem would be to create a control with this ControlSource:
=Val(IIf([Category]="S", 1, 0))
...then Sum() on that control.
I don't like the idea of using a DCount() as it requires a hit on the database for data that's already in the form. Secondly, if this is in a subform, the DCount() would need to be filtered not just on the Category value but also on whatever the link field is between the subform and its parent. It just gets so fussy that I'd say it's better to go with something that can be derived from the recordset already loaded in the form.

Multiselect Form Field in PDF

Using PDF, is it possible to create a single form element with multiple fields of which several can be selected? For example, in HTML, one can create a set of checkboxes associated with the same field name:
<div>Select one for Member of the School Board</div>
<input type="checkbox" name="field(school)" value="vote1">
<span class="label">Libby T. Garvey</span><br/>
<input type="checkbox" name="field(school)" value="vote2">
<span class="label">Emma N. Violand-Sanchez</span><br/>
In this case, the field name is "field(school)", and when the form is submitted, "field(school)" can be supplied 0, 1, or 2 times.
Is there an equivalent construct in PDF where a single field can have multiple values. So far in my investigation, it appears that if fields are assigned the same name, it is only possible to select one field. If it is possible to implement this in PDF, what is this construct called and how can it be implemented?
Edit: To clarify, I am aware that a PDF can contain multiple form fields with different field names, and those can be selected independently, but then the grouping is implicit and not explicit as with the HTML form. I would like to use a construct that makes the grouping of options explicit, and preferably allows for restrictions (e.g. at least one required, no more than 2 allowed, etc).
Edit: If someone can find an authoritative opinion that this is not possible, that would also be a desirable answer.
Yes it is possible. In Adobe PDFs you have the checkbox concept and the radio button concept. While each checkbox and radio button can have its own name, however, they can also be grouped through a subtier via the GroupName.subobj.
Adobe describes it as follows:
The field name. This may include
hierarchical syntax in order to
facilitate logical groupings. For
example, the name myGroup.firstField
implies that the form field firstField
belongs to a group of fields called
myGroup. The advantage of creating
logical hierarchies is that you can
enforce consistency among the
properties of related form fields by
setting the properties of the group,
which automatically propagate to all
form fields within the group.
When the fields are set via a hierarchy you can then get the value of myGroup in this case, and return the selected value of the group. Similarly in the case of RadioButtons you would make sure that all fields in a group have the same name.
This approach to creating form fields
is applicable to all fields, but it
should be noted that radio buttons
require special treatment. Since a set
of radio buttons represents a set of
mutually exclusive choices, they
belong to the same group. Because of
this, the names of all radio buttons
in the same group must be identical.
In addition, the export values of the
set of radio buttons must be set with
a single statement, in which an array
of values are assigned by the
exportValues property of the Field
object. For example, suppose we would
like to create a set of three radio
buttons, each 12 points wide and 12
points high, all named myRadio. We
will place them on page 5 of the
document, and their export values will
be Yes, No, and Cancel. They can be
created as shown in the code given
below:
var name = "myRadio";
var type = "radiobutton";
var page = 5;
var rb = this.addField(name, type, page, [400, 442, 412, 430]);
this.addField(name, type, page, [400, 427, 412, 415]);
this.addField(name, type, page, [400, 412, 412, 400]);
rb.exportValues=["Yes", "No", "Cancel"];
asnyder's response led me to the conclusion that there is no automatic way to handle multiple values within a single field (as one can with HTML). asnyder's examples come from Developing Acrobat Applications Using JavaScript, available from the Acrobat Javascript Developer Center. This document provides some examples of how to manipulate checkboxes, combo boxes, and radio buttons. All of the examples shed some light on the problem and ultimately led me to the conclusion that any system that is using PDF forms will have any multi-selectable groups implicitly defined.
Using the construct of groupName.fieldName appears to be useful to manipulate the widgets as a group (in Acrobat Javascript), but the fields of a group cannot be enumerated (without enumerating all fields and filtering for the groupName), and the collective value of that group cannot be determined without programatically inspecting the values.
In other words, a multi-selectable value is not an intrinsic feature of Acrobat nor of PDF in any substantial way, though it is possible to implement such a form through programming.

Resources