Extracting Company Organization Chart from Office365/AzureAD/ActiveDirectory - active-directory

I am trying to find where and how I could extract the data from our company to use in Power BI.
We are using AzureAD/Office365 (synced with Active Directory) to manage our users. The data is entered so that we can see the reporting structure in our various applications.
If it is unclear what I mean, you can see the link below
Creat Orgchart structure on Asuze AD
I was hoping someone knows how the data can be retrieved and had some examples of how to collect the data.
I have found meaningful examples to do the rest of the work (e.g. Parsing Organizational Hierarchy or Chart of Accounts in Power BI with Parent-child Functions in DAX) but I am stuck with figuring how to extract the data. Off-course I could maintain a separate chart, but it is likely that it would get off-sync and requires additional time to maintain (when employees onboard/off-board).
I have found one link explaining how to get data from Active Directory, but I believe that the information extracted in my case does not contain the data I seek.
Active Directory hierarchy - getting all users inside a group including child groups
I hope that someone implemented this previously and can share some code and or guidance with me. If I find a solution I'll make sure to post some code.

Based on the reference from So thread.
We can extract the data of Company Organization Chart (Upwards \ Downwards)
Up Hierarchy:
GET /me/manager
GET /users/{id | userPrincipalName}/manager
Also,
https://graph.microsoft.com/v1.0/me?$expand=manager($levels=max;$select=id,displayName)&$select=id,displayName&$count=true
Down Hierarchy:
GET /me/directReports
GET /users/{id | userPrincipalName}/directReports
Reference:
https://learn.microsoft.com/en-us/graph/api/user-list-manager?view=graph-rest-1.0&tabs=http
https://learn.microsoft.com/en-us/graph/api/user-list-directreports?view=graph-rest-1.0&tabs=http

Related

How to provide visibility to users based on field criteria?

How do I provide visibility to records for users based on field criteria?
My demand is: When I have some specific object Files with some specific products the users that contact in this accounts that have this product will see this register of Files. Like:
I create a register on the object File with the field product fill with 'B'';
The account with some specific record type also has the field product filled with 'B' and 'C';
Because of that, the contacts (that are users in the community) present on this account will have access to the object File, because it contains 'B'.
How to reach this solution? I think about a trigger on the object File that will check the accounts that contain the same product, and then, create a sharing rule for that, but I don`t know if is the best option and also, because of the limit of 300. It's that any other way?
Uh, interesting one! You mean real Files (ContentDocument, ContentVersion), not some custom object, right? Files are bit tricky, normally community user would see all files attached to their account + special "Asset" files.
trigger on the object File (...) and then create a sharing rule
Don't think it'll work. Sharing rules are metadata, not data. You'd need a deployment or cheat by making API callout. But also sharing rules don't really work for community, you're supposed to use sharing sets.
You could try making ContentDocumentLinks between the file header (ContentDocument) and Account. And yes, you should be able to do it from trigger. I don't remember if there are limitations like 1 file can be linked at most to X records, this might be tricky. a change of Account's product would potentially mean lots of links to add/remove, maybe move this bit to #future / Queueable.
Alternatively you could just make all files & their folders visible in the community, maybe even for guest user (look into Asset files?). And just show / hide links to their folders based on what's on the account. Bit "security by obscurity" but well, fairly easy to do, adding/removing products wouldn't mean lots of operations. Depends if these files are somewhat sensitive or it's more about guiding the user to what they're interested in.
Ask on https://salesforce.stackexchange.com/ too, somebody can have even better ideas.

Salesforce: How to have user select multiple Products and have them assign it to a single Opportunities?

Product is related to Parts thru a junction object 'ProductPartUse' so its Product -> ProductPartUse <- Part. I want the user to select multiple Parts and lookup to a single Product and have all Parts be assigned to the Product thru the Junction Object ProductPartUse. I think we may have to use a visual force page or a lightning component with Apex code to accomplish this. If someone can help point to some existing sample code or help me get started. Thanks
You do not need to write custom code in VF/Aura/LWC. This can be accomplished using standard functionality with ProductPartUse sObject having two master-detail relationships (one to Product and one to ProductPartUse). The interface would not be as easy for the user, because they would need to do one ProductPartUse record at a time. If you want to have one screen where they can simultaneously select multiple parts and associate it with a product, then yes... you do need custom code. I would suggest you build it using LWC because the other 2 technologies are old (not deprecated, but not as cool). But if you are not comfortable with code, then look into flows.

Constructing a database that collects information from two public surveys and imports answers to a hidden back-end

I am fairly new to constructing databases and was hoping I could get pointed in the right direction on this project. I have self-taught how to use Microsoft Access (my boss is asking that I specifically use this program) and how to "build a database," but I'm stuck on the abstract, specific functions I'm expected to implement. I'll post what I have come up with from all my research to show I've attempted this on my own before asking, but I would greatly appreciate drawing from the expertise of this community. Thanks for all of your time.
Context:
There is a manager survey (1) and an employee survey (2). Every few months, we have leadership roles open up and the managers fill out a survey with all the information regarding the role (opportunity) that they will be in charge of. After all the managers answer, the hopeful employees then review all of the new opportunities, fill out their own survey with some similar questions (and others unique), and indicate what opportunity they are most interested in. Once they fill out their surveys, the data is collected and matched up to the opportunity they wrote they wanted.
My thought process:
The backend can't be editable by those taking the survey - they (managers and employees) should only be able to add a new, non-existent record to their respective table (from the info entered in their survey). The DB would be stored in a
(1) Manager fills survey out (a form created from Mgr_FormShare - a middle man table), import data to backend db table (Mgr_SurveyDataMain)
*Split DB
*Use form as front-end, "properties_data entry: yes"
*Set up relationship between table inside backend and form
(2) Employee reviews opportunities, chooses DESIRED opportunity# and fills in rest of data (in a form created from Emp_FormShare / middle-man table), import data to backend db table (Emp_SurveyDataMain)
*Split DB
*Use form as front-end, "properties_data entry: yes"
*Set up relationship between table inside backend and form
(3) Run query, imports both surveys into one table in backend (ManagerEmpCombineData)
(4) Append an Assigned field in the Mgr_SurveyDataMain (if an opportunity is discovered as chosen, it's "assigned" status goes from no -> yes)
My questions:
Is this the correct way to approach this situation? Is there something I am missing here?
Also, is there a way to ensure all surveys (about 200+ when employee + manager count) will automatically share to the middle-man + only allow one entry per individual? Before splitting, I wanted to make sure that the forms with the properties [DataEntry: "Yes", RecordsSource: "*_FormShare", Each field's control source: linked to respective *_FormShare field] would be enough to make sure that they synced. It's okay if I can't ensure only one use, the sync is the most important aspect.
Thanks again for taking the time to go through my question!

How to save user specific arrays in Mailchimp

For quite a while I am struggling with how to save custom user specific arrays of data in Mailchimp.
Simple example: I want to save the project ids for a user in Mailchimp and in best case be able to use them there properly as well. Let's say user fritz#frey.com has the 5 project ids 12345, 25345, 21342, 23424 and 48935. Why is there no array merge field that let's me save this array of project ids to a user?! (Or is there one and I am just blind...)
I know I can do drop down fields to put users in multiple groups, like types of projects for example, but the solution can hardly be a drop down with all (several thousand) project ids and I check the ones the user is a part of (and I doubt that Mailchimp would support that solution for a large number of group items anyways).
Oh and of course I could make the field myself by abusing a string field and connect the project ids with commas or a json string but that seems neither like a clean solution nor could I use the data properly in Mailchimp (as far as I know).
I googled quite a bit and couldn't find anything helpful sadly... :(
So? Can anybody enlighten me? :)
Thanks for all your help!
It sounds like you have already arrived at the correct answer: there is no "array" type, other than the interests type, which is global and not quite the same as an array.
The best solution here sort of depends on your data. If each project ID will have many different subscribers attached to it, and there won't be too many of them active at any given time, I'd just use interests. If you think there may be dozens of project ids active simultaneously, I'd not store this data on the subscribers at all, instead I'd build static segments for each project, and add users to them.
If projects won't have a bunch of subscribers associated, I'd store the data on your end and/or continue using the comma-separated string field.

Quickbooks Data Schema?

I'm trying to develop a simple app for my staff to log their time and expenses on a remote (access) db, and then sync that with QuickbooksPro. I have managed to get QBFC to work, my problem now is understanding the underlying database structure (field names etc) in Quickbooks - e.g. so I know which elements to add to queries etc.
I have found the following (EntityRef, CustomerRef) by trial and error, and by looking at a table pulled using QOBDC; however, there must be documentation of this somewhere - anyone know where?
TimeDataQry.IncludeRetElementList.Add("EntityRef")
TimeDataQry.IncludeRetElementList.Add("CustomerRef")
TimeDataQry.IncludeRetElementList.Add("TxnDate")
TimeDataQry.IncludeRetElementList.Add("BillableStatus")
TimeDataQry.IncludeRetElementList.Add("Duration")
TimeDataQry.IncludeRetElementList.Add("TimeModified")
to be honest, the actual QB data schema is horrible - huge and confusing. It's not worth trying to figure out how to interact directly with their API. That's one of the reasons people like QODBC created simpler ways to interact with it. Have you purchased QODBC?
I've created apps using QODBC and RSSBus, and I like RSSBus better. There are many reasons, but for starters, QODBC is actually a driver that uses DNS's, which can be confusing and have to be set up on each computer that you want to use this on whereas RSSBus does not have any of that. What QODBC and RSSBus do is wrap the QB db in a sort of sqlserver-like db, so any table structures you pull from the QODBC tool will most likely have no correlation to anything you could use through QBFC.
I prefer RSSBus now, but here are links to documentation for both:
RSSBus - http://www.rssbus.com/kb/help/RQR3-A/pg_imetracking.rst
QODBC - http://doc.qodbc.com/qodbc/Qodbc_20_us.html
Also, this SO question may help - QuickBooks QBFC explanation. Notice that he says there are 300+ pages of documentation for this. A little too much imo.
Use the QuickBooks OSR (it works best in Chrome):
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
Choose the request/object type you're dealing with from the "Select Message" drop-down, and click on any of the nodes to view documentation on the node.
For example, what you posted above looks like you're looking at Time Tracking entries. Here's what you get from the OSR about EntityRef:
Entity
A QuickBooks "entity" is a customer, vendor, employee, or
person on the QuickBooks "other names" list. Special cases to note:
In a BillToPayQuery message, EntityRef refers to the vendor name.
In
JournalCreditLine and JournalDebitLine messages for A/R accounts,
EntityRef must refer to a customer, or else the transaction will not
be recorded. For A/P accounts the EntityRef must refer to a vendor, or
else the transaction will not be recorded.
In a TimeTracking message,
EntityRef cannot refer to a customer, only to an employee, vendor, or
person on the "other names" list whose time is being tracked.
Pretty simple, pretty detailed.
It's also worth noting that the QuickBooks APIs almost exactly mirror the QuickBooks GUI. For example, when creating an invoice in the QuickBooks GUI, you'll see fields like:
Customer
Date
Invoice #
Item
PO Number
And then if you look at InvoiceAdd in the API, you'll find these fields:
CustomerRef
TxnDate
RefNumber
ItemRef
PONumber
It shouldn't be terribly difficult to put two and two together and figure out that these fields match the fields presented in the GUI.
Here is the QODBC documentation on table schemas:
All Tables.
If you want specific US related table groupings like Customer and AR then check here:
Tables by Group

Resources