I am working with ADF master detail concept.
Header form (master page)
Detail form (Detail page of Header (master page))
SubDetail form (Detail page of Detail (master page))
So:
Header page has h_id as primary key.
Detail page has d_id(Detail) and h_id(Header) as primary key.
SubDetail page has s_id (subDetail),d_id(Detail) and h_id(Header) as a primary key.
Once I will navigate from header page to detail page and after doing any insert or update, the table will be refreshed and will fetch details of first row of the table.
I tried two approaches:
First one, get the binding of the header VO and set the rowkey of setCurrentRowWithKeyValue with header h_id value:
BindingContainer parent_binding =getBindingsContOfOtherPage("view_headerPageDef");
OperationBinding opt =parent_binding.getOperationBinding("setCurrentRowWithKeyValue");
opt.getParamsMap().put("rowKey",h_Id);
opt.execute();
As it is finding h_id only for detail (d_id), this will work.
But From detail, when I am navigating to subdetail page, the above concept is not working. It's not fetching the subdetail for current row of detail. It's fetching for first row only.
I assumed, that here subdetail requires both detail (d_id) and header (h_id). But I don't know how to put both values together in rowKey attribute.
Another approach I tried is to get the key of the currentRow in VO and set it programmatically:
BindingContainer bindings = getBindings();
BindingContainer parent_binding =getBindingsContOfOtherPage("view_DetailPageDef");
DCIteratorBinding child_dciter = (DCIteratorBinding)bindings.get("SubDetail_VO2Iterator");
DCIteratorBinding parent_dciter = (DCIteratorBinding)parent_binding.get("detail_VO2Iterator");
Key DetailKey=dciter1.getCurrentRow().getKey();
Key parentKey=parent_dciter.getCurrentRow().getKey();
parent_dciter.setCurrentRowWithKey(parentKey.toStringFormat(true));
dciter1.setCurrentRowWithKey(DetailKey.toStringFormat(true));
But this concept will also work at header and detail level. It is not working for detail and subdetail level.
I am getting Null Pointer Exception at getCurrentRow().getKey().
How can I achieve this?
I have got understanding of the master - detail relationship in ADF. Basically it works with setCurrentRowKey concept. Whenever, we will create master detail relationship, it will also create view link and association with it. This view link and association will point to the primary - foreign key relationship of the respective parent - child table.
Whenever, we are dealing with 3 level master - detail - subdetail concept,we need to get all 3 row keys programmatically.
So the solution that worked for me is :
//Current Page Binding Object (SubDetail)
BindingContainer subdetail_binding = getBindings();
//Detail Page Binding Object (Detail)
BindingContainer detail_binding =getBindingsContOfOtherPage("view_DetailPageDef");
//Master Page Binding Object (Master)
BindingContainer master_binding =getBindingsContOfOtherPage("view_MasterPageDef");
//Subdetail VO Iterator
DCIteratorBinding subdetail_dciter = (DCIteratorBinding)subdetail_binding.get("SubDetail_VO2Iterator");
//Detail VO Iterator
DCIteratorBinding detail_dciter = (DCIteratorBinding)parent_binding.get("detail_VO2Iterator");
//Master VO Iterator
DCIteratorBinding master_dciter = (DCIteratorBinding)master_binding.get("master_VO2Iterator");
//get Row Key of all 3 level Iterators
Key MasterKey=master_dciter.getCurrentRow().getKey();
Key DetailKey=detail_dciter.getCurrentRow().getKey();
Key SubDetailKey=subdetail_dciter.getCurrentRow().getKey();
//set Master Page Row Key
master_dciter.setCurrentRowWithKey(MasterKey.toStringFormat(true));
//set Detail Page Row Key
detail_dciter.setCurrentRowWithKey(DetailKey.toStringFormat(true));
//set SubDetail Page Row Key
subdetail_dciter.setCurrentRowWithKey(SubDetailKey.toStringFormat(true));
To get SubDetail level details both Master and Detail must be set,then only you are able to get SubDetail level details, otherwise It will throw NullPointerException.
Related
I have created a custom object called Onboarding and created a master detail relationship between it (detail) and the Account (master) object. It shows up fine in report builder and I have added it to the account page layout as a related list no problem.
I want to have a flow create records in the Onboarding object (related to an account), however, in the Create Record element, the Onboarding object is not available for selection in the 'Create a Record of this Object' field. I start with a 'Get Record' to get the account I want to use as Master, execute a screen element to gather some information, then want to do the create. What am I missing?
I have below PostDetail Model defined
from wagtail.core.models import Page
class PostDetail(Page):
template = "Post_Detail.html"
body = RichTextField(blank=True)
After python manage.py migrate, when I examine the database table of PostDetail, I only see 2 columns (attributes) and did not see all those attributes (title / owner / first_published_at etc according to the source code here.) which are supposed to be inherited from Page model.
Anything I missed out or did wrong ?
Wagtail's Page model uses multi-table inheritance - the shared fields from the base class are stored in a record on the wagtailcore_page table, while the fields specific to a subclass are in a separate table with a link back to the base wagtailcore_page record.
Having all of the 'core' fields in a single table makes it possible to retrieve (for example) the child pages of a given page, without having to search in every table for every possible page type.
i have created a custom button 'create note' in list view of leads. An extra column of create note appears as shown below in link(image).
through that 'create note' button i am sending the lead id as record in url as - http://localhost/cod/suitecrm/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DNotes%26action%3DEditView%26return_module%3DNotes%26return_action%3DDetailView%26record%3Da0deb972-35e7-d909-41be-5be96467233c.
after clicking on the create note button i want to fetch that record id and want to autofill the related field lead using that record lead id in create note.
i want the same functionality that appears after opening a lead below the history tab create note with autofill related lead name on list view of lead using that button 'create note' in list view
kindly help
links for images below:
drive.google.com/file/d/1SPJlSSg1qDgtkJEw5NX_5ZaUTgW8T2m1/view
drive.google.com/file/d/1EQcg_TI7FgjXCHgHVK-nhmEqCxsce69q/view
I have a problem with one of my forms in my MS Access database, and strangely it's the only form that has this problem.
The form has a typical Master/Detail structure, with the subform tied to a table. The subform record source includes a foreign key that pulls information from another table and populates the rest of the fields based on the key value. This foreign key is a Material number that defines a specific object in an inventory, and the other fields in the subform show details of this object.
Example from Signs table:
Material number: 116063175
StorageBin: A116
Material Description: Stop Sign
Dimensions: 48x48
All of this information is contained in the same table, but the form is for a table that is used to fill in what signs are on a particular road (stops, speed limits, etc.)
On all my other forms, when I type in the material number and shift focus anywhere else, the rest of the forms will fill in automatically. This process works here too, but for some reason Access wants to try to fill in the rest of the field data before I have finished typing the material number. I'll type "1" and access will throw an error that it cannot find a matching record in the Signs table in the foreign key's table. After rejecting the error twice, the data entry can resume as normal, which is also strange.
I hope I've been clear enough, this is my first time asking a question here.
Thanks in advance!
Edit: Tried re-building the form, same issue. Built another form similar but without my multiple comboboxes, didn't have the issue! Could this be due to underlying requery code in the Afterupdate event of my comboboxes? I have a cascading combobox setup on the form, could data entry be triggering a requery?
Edit2: for the time being, a fix that I am using is to make the material number and quantity (the two important fields for this form) into text boxes outside the subform, that the user can edit then place in the subform with a button click, which is coded as so:
Private Sub Command1_Click()
If Me!PrimaryRoadInventorySubform.Form.Dirty Then
Me!PrimaryRoadInventorySubform.Form.Dirty = False
End If
Me!PrimaryRoadInventorySubform.SetFocus
DoCmd.GoToRecord , , acNewRec
Me!PrimaryRoadInventorySubform.Form!MaterialNumber = MaterialNumtxt
Me!PrimaryRoadInventorySubform.Form!Quantity = Quantitytxt
End Sub
I am creating a junction object called Candidate_Position.This has two parents candidate and position.I have to go to the Candidate Detail page and in the related list create a new Candidate Position.The next page is a VF page where I select the Position to associate with the new Candidate Position and click save.The condition however is,I have to validate if the position I am associating is not already associated with any Candidate Position having the same Candidate parent.
For example if there is Candidate "Paul",and under that I am creating a Candidate Position trying to associate Position "Dev",the other Candidate Positions under Candidate "Paul" should not have "Dev" as parent Position.If the user tries to add the "Dev" then they should get error as "Cannot Add this Position to this Candidate Position"
So what Validation Rule I have to give for the Junction Object?
If validation rules are not the way to show this kind of error,then should I use something else? BTW i need to use this junction object anyhow.
I am completely new to Salesforce,and would appreciate some answers.Thanks :-)
Either you don't need a Junction object or you don't need this Validation Rules.
Junction object allows you to create many to many connection between object, which are trying to avoid with this VR.
To avoid VR I suggest you remove Candidate_Position object at all and create a lookup on a Position object to Candidate. This will be one to one, which you are trying to achieve with VR.
EDIT:
ok, If it is a VF page, then in save method you need to [SELECT Id FROM Candidate_Position WHERE Position = :currentPositionId]. Check if it is 0. If it is not, then you already have Candidate_Position with currently selected Position.
EDIT #2:
I think, you should be able to use VLOOKUP function in VR.