How to show records related to upper records too in a subgrid? - dynamics-crm

How can I build a subgrid that displays related records both of the current record and records above it, and can it contain complex conditions ?
One of my requirements is this:
I want to put a subgrid in Account form showing the related Contacts of the current Account, and also include the Contacts related to Accounts above the current one if a Two Options attribute of the contact is set to Yes.
Specifically, I'm looking at the Company Name on Contact to establish it's related to an Account.
I'm at a loss and start to doubt it's doable.

Not an out of the box solution but if you don’t mind losing the sub grid command bar functionality you can use the following concept that displays a fetchxml inside a sub-grid.
Step 1 - would be to get all related accounts ids using a fetch or odata
Step 2 - construct a fetchxml with OR filter to get all contacts

Related

Add a sub grid and view for field update

I have added a field to the Contact entity called Website Downloads. This field is updated every time a client clicks on our website but what I want to do is have a sub grid within the Contact form that shows what this entry is each time it's updated. Then I ideally need this in a view with the contacts name and a list of the downloads so I can do an advanced find on the field. Any ideas please. PS I have tried to add a new entity that links to this field but the problem is you cannot do an OR on an Advanced find for 2 separate entities so back to square one.
Already tried a new entity but this won't work as you cannot do an OR on an Advanced Find for 2 entities.
I think you are on right track. You need a related entity to capture all the website hits, then you need a rollup field on contact record to sum up the hits.
So the associated records can be listed in a subgrid on contact form, also Advanced find queries can be done.
Rollup field can be an OOB field but it has timely job to calculate, if you want immediate rollup result it can be a custom field & plugin to accumulate.

How do I create a report in ServiceNow of all my incidents which do not have an affected CI?

I'd like to create a report in ServiceNow to list all incidents for a specified Assignment Group which do not have any Affected CIs.
I can create a report of incidents that do have Affected CIs using the task_ci table, but entries are only added to that table if a CI is affected. Is there a way to list incidents that do not appear in this table?
There is another way to do this directly on the List view if you have list v3 plugin enabled in your instance.
You can navigate to the incident list view and apply this filter on the related list
Make sure you specify the condition for Related list as Affected CIs Equal to 0
Using the Report Designer interface that was introduced in Jakarta, you can add filters on Relationships.
Simply add the relationship filter for no Affected CIs (you do not need any conditions) under the main filter on the Incident table. (refer screenshot below)
The ability to report on record relationships is not available without using the Report Designer.
For future ServiceNow questions, you're more likely to get an answer by creating a community account and posting there: https://community.servicenow.com
screenshot

Query to find order products for related accounts in Dynamics CRM

On the Accounts form, I want to be able to show all Order Products for that Account and any related Account. My aim is to give the user an easy way to see what has been bought by a customer with several related offices (Accounts).
Any idea how this can be done?
There is a way to do this with a plugin. The general steps would be:
Ensure the view that is used on the order product subgrid on the Account form is not used anywhere else.
Make a unique change to the view columns or filter criteria that will let you distinguish it from other views. For example, you could add a condition of "createdon contains data", which most likely would not be used anywhere else
Create a pre-RetrieveMultiple plugin on Order Product.
In the plugin, get the query from the input parameters and check for the "createdon contains data" condition. If it does not exist, exit the plugin.
If the condition exists, this is the view you want to update. In the query, find the condition that has accountid.
Use the accountid to retrieve related child and parent accounts.
Update the query with a condition checking if accountid is in the list of all the accountids you retrieved.
The query should now return all the relevant order products and display them on the Account form.
This is a rather involved solution with only the high level steps outlined here.
Here is a link that shows an example of modifying a query in a pre-retrievemultple plugin:
https://hachecrm2011.wordpress.com/2013/07/19/filtering-views-by-intercepting-retrieve-multiple-queries-with-a-plugin/

Filtering instances not related to the current contact

I have a custom entity Stuff and it contains a lookup to Contact. I created a 1:N relation with the latter as primary and the former as related entity.
On the Contact's form I added a subgrid and I only wish to list the instances of Stuff that have the lookup pointing to the currently viewed Contact. However, when I choose Only Related Records, the custom entity isn't in the list (despite it being related via the 1:N relation).
So, I'm using All Record Types, instead, but that shows all the instances of Stuff and not, as I wish, only those that are related to the currently viewed member.
So, what's the best course of action here? Should I do something with the relation? Or build a custom filter in JavaScript? How can I make the Stuff related to Contact if it's at all possible?
The image below shows the available conditions for the related entities. I notice that none of them relates to Contact, though. Do I need to activate it somehow or am I approaching it from a totally wrong angle?
So to give you more detail, you add the grid on the form:
(This is coming from the contact Form edit, after you press add subgrid)
you select there only related records, this are the stuff record i created:
As you can see only 3 of them has a lookup pointing to a valid contact, from there if you look at the grid, is showing only the related ones as you selected during the grid creation:
In any case i update the answer this is how the relationship is defined, and is a simple lookup created from the stuff entity:

FileMaker Pro -- Filtering Relationship Not Working

I'm trying to build a FileMaker Pro 11 layout that excludes records containing a certain value. The relevant data is in table Invoice. I want to filter so that Invoice records whose "Invoice Check Grouping" field is blank are not displayed on the layout.
I've added a global field to the invoice table called "Blank Invoice Check Grouping" to use as my filter criteria. I've created a self-join relationship to the Invoice table, joining "Invoice ID" to "Invoice ID" and joining "Invoice Check Grouping" to "Blank Invoice Check Grouping". The resulting table is named "Invoice Check Groupings".
The layout which I build based on table "Invoice Check Groupings" shows all records in Invoice--it does not filter out those with blank values. What am I doing incorrectly?
Thanks,
Ben
Layouts show records in a table (or more accurately, a table occurrence) and don't directly deal with related data. As mentioned by #pft221, you can use relationships for filtering, but only when viewing data through a portal.
If you always want a particular layout to show data based on a particular find, you can do so with a script and a script trigger. First set up a script to do the following:
Enter Find Mode[]
Set Field["Invoice Check Grouping"; "*" // Find all records with any data in this field
Perform Find[]
Note that you can also embed the find request within the Perform Find script step, but I tend to script finds in the above manner as it's easier to see what the find request is in the script and variables can be used in the find request.
Now you need to set your layout to execute this script whenever it's loaded. Go to the layout and enter Layout Mode. Select Layouts>Layout Setup from the menu bar. Click the Script Triggers tab and check the box for OnLayoutEnter and select the script you wrote above. Now whenever the layout is entered, that script will run and exclude the records that have that particular field being empty.
There are many ways to filter records, depending on what you are trying to do and what you are trying to display for your users.
The most common and simple way you can filter records is through a simple Find in a list view. I'm unclear from your question, but my best guess is that you're already using a list view and misunderstanding how FileMaker's relationships and Table Occurrences (TO's) work.
To Filter with the "Find Records" method:
Create a new List View layout of any Table Occurrence of your Invoice Table -- most likely you will want to use the default Table Occurrence that FileMaker created for you when you created the table.
Place the fields that you would like to display on that layout, including the "Invoice Check Grouping" field.
Switch into Find Mode
Put a '*' character into the "Invoice Check Grouping" field
Perform the Find
You should now see a list of all Invoices where the "Invoice Check Grouping" field is not blank. (You can find additional interesting search criteria in the "Insert: Operators" drop down of the title bar.)
Now you may actually be looking to filter related records through a portal but, given that you've set up a self-join on the Invoice index on the Invoice table my guess is that, at best, this would show either 0 or 1 record for each Invoice record you display in your main layout.
To Filter Records with the "Portal Filter" method:
Let's assume, though, that you have a Client table where you'd like to see only the records with a non-blank "Invoice Check Grouping" value. The table set-up would be as follows:
Client
Client ID
[... other client info ...]
Invoice
Invoice ID
Client ID
Invoice Check Grouping
[... other invoice info ...]
With a relationship in the relationships graph:
Client::Client ID ------< Invoice::Client ID
From there you would set up a Form layout on the Client TO and create a portal showing records from the Invoice TO. From the options for the portal you would select "Filter Portal Records" and use a formula similar to:
not IsEmpty(Invoice::Invoice Check Grouping)
Finally, it's worth noting that a portal filter isn't appropriate for all display situations or calculations. You can set up a similar filter completely through your relationships graph (as I believe you have already tried to do.) This will work, once again, for viewing records through a portal but not for the records displayed by a layout itself.
The answers above don't actually help Ben with his question. They are workarounds.
I have the same problem as Ben, and I don't think there is a solution, even now in Filemaker 12. There is I think no way to define a relationship that will omit the related records where the match fields are empty.
Two options come to mind:
On a specific layout, you have more fine-grained control in the portal definition itself, and can use this to exclude the records
You can now use SQL queries to achieve this result within Filemkaer.

Resources