Azure Maps Indoor Module: Change floor without user input - azure

I've been working with the Azure maps indoor module https://learn.microsoft.com/en-us/azure/azure-maps/tutorial-creator-indoor-maps . You can allow a user to pick a level with a level control element from the library, however I cannot figure out a way to pre-set a certain level (e.g. I want to start with a certain facility and the 2nd level pre selected when the map loads.) For the facility there is a indoorManager.setFacility() function that allows you to select a facility but I have not found the equivalent for the level.
Requirement: I want to to select a level in Azure Maps without user input.

There doesn't appear to be any official way to do this yet, note that Azure Maps Creator is still in preview. That said, I did figure out a hacky way around this (may break in the future).
var facilityId = 'FCL13';
var level = 2;
//Set the facility and the levels "ordinal number". The ordinal number appears to be off by 1.
indoorManager.setFacility(facilityId, level - 1);
//Used to trigger the level control to refresh.
map.events.invoke('moveend')

Related

Dynamically Selecting Map in Logic App

I am trying to build a logic app that receives incoming X12 EDI messages. I have an integration account set up and an agreement created. However, I don't see a way to associate a map with an agreement. It seems I have to hard code this in the logic app which would mean one logic app for each trading partner document type. Surely there is a way to select maps based on sender, receiver and document type. This is basic functionality for other EDI packages but I don't have a clue with logic apps.
Not sure whether there is a better way, but you can specify the map name at run time.
Then, as you are already using an integration account, you can externalise Business Rule using liquid templates, as explained here: https://blog.mexia.com.au/business-rules-on-azure-logic-apps-with-liquid-templates
You could pass some metadata about the trading partner to the liquid template, and then return the name of the map and use it in the mapping action.
HTH
Actually, this is almost as easy as BizTalk Server* ;)
Since the Map Name can be composed at runtime, you can upload your Maps using a set pattern, for example [SenderID] + "_" + [MessageType] -> "CONTOSOSID_810"
Then Initialize a Variable set to [SenderID] + "_" + [MessageType] and use that as the Map parameter to the Liquid Action.
Important Point: Every output of the X12 Decoder can loop so you may have to manually index the paths in the Initialize Variable depending on if/how you're debatching the transactions.
*BizTalk Server automatically resolved the Map based on the Party's message Type which you could use here, just that the names are a bit messy.

Are multiple (PUTs) need for Turning on/off multiple lights using lights API?

I am using the following script: https://github.com/callil/SparkHue/blob/master/sparkhue.ino
This is working great besides the fact that it only lets me control that one light with id 3. What is I have multiple light ID's I want to turn on / off with the light API. Do I need to make multiple calls for each?
client.println("PUT /api/deviceAddress/groups/1/action HTTP/1.1");
client.println("Connection: keep-alive"); //
client.println("Host: 192.168.1.11"); //same as server
client.println("Content-Type: text/plain;charset=UTF-8"); //
client.print("Content-Length: "); //param
client.println(11+len); //brightness string + val length
client.println(); // blank line before body
client.print("{\"bri\": ");
client.print(val); //value of potentiometer
client.println("}");
Serial.println("sent");
Instead of performing individual commands on each light ID, you can create a group of multiple lights.
Assuming you want to perform a command on all your lights, you can use the all-lights-group, which has ID 0. Instead of using the /lights/3/state path, you can use a group path similarly:
/groups/0/action
To create a group you need to perform a POST on /api/<username>/groups with the IDs of the lights the group should contain and also the name of the group, but you can read it all here: Create Group API.
You could dynamically create a group, perform actions, and then remove the group again afterwards..
This might only be a smart workaround if you need to apply an action to a lot of lights.
I would probably go for just using multiple puts (one for each light if its just some few), or creating a static group.

How should I implement `OnLoad` event handler when creating an activity using a contact?

I've created my own solution with a custom entity of type activity. I'd like to show a message whenever a new instance of it is created using an existing contact but not allow the user to create one, if only attempting to do that without going via contact.
Basically, my aim is that it won't be impossible to just create that activity (the form will be hidden directly at any attempt except for one way only). The user will have to go to contacts (or leads etc.) and in there add and create an instance of the custom activity entity. That way, I can assure that the field "regarding" will be filled out already.
I'm guessing that I need to detect somehow that the opening of the form is a creation attempt. How can I do that?
Also, as it is now, the user can't create a contact-less activity of the custom type because it doesn't appear on the menu with other activities. I must have disabled it somehow but I have no idea how. Anybody who has one?
You could do this a bunch of ways but the easiest would probably be to:
Make the regarding field read only.
Make the regarding field mandatory.
That way if a user opens a create new form they wont be able to set the regarding and because its mandatory they wont be able to save the record. When they open via an existing contact the regarding field will be mapped automatically. That said in this case just making it mandatory my be enough.
(As a side JavaScript can be used to identify the current form state, but I'm not sure how useful that is here).
In terms of where custom activities appear, by default mine show in a number of locations, for example:
CRM > Workplace > Activities > Ribbon > Other Activities > XXX.
CRM > Workplace > Activities > View Selector > XXX.
They don't show under the left hand navigation of the workplace because they are grouped under 'Activities'. I'm pretty sure these are all the default settings.
You can exercise greater control by editing the sitemap, where you can put pretty much anything, anywhere.
In addition to Mr Wood, I'd like to show you some code. It works as supposed to but I'm not sure if it's optimal.
var foo = function () {
var whatIsGoingOn = Xrm.Page.ui.getFormType();
if (whatIsGoingOn === 1)
alert("Let there be an entity!");
else
alert("Not a creation...");
}
The other states' (deletion, update etc.) numeric values are listed here.
Answering the second part of your question:
When you create a custom activity you can choose whether to have it appear in 'normal' Activity menus or not by checking the box at the top right of the entity form. This is a once-only choice as far as I know and can't be changed later.
For your setup, I would suggest NOT checking this box, so it does not appear in the activity menus to avoid users even being tempted to do it that way.
Instead, add an explicit relationship to the activity N:1 to Contact, and another N:1 to Lead. Use this relationship to add your activity to the left navigation of Contact and Lead forms, or add a grid for them (depends on how you want to use this and if you need to filter the view to something other than the default "Associated View").
When a user navigates to this section they will see if any previous activities of this type exist, and be able to add a new one. BUT this means that the child record is a child via this relationship, not using "regarding", so use a script on the form for the activity so that if Contact is filled in, it is copied to Regarding, and if Lead is filled in then that is copied. If neither, then use an alert or other means to warn the use that something is wrong (see comment earlier). If you want Regarding to be read-only but filled in by script, you will need to make sure to use the force the value to be saved:
Xrm.Page.getAttribute("regardingobjectid").setSubmitMode("always");
You must have the lookups for Contact and Lead on the form to be able to use them in your scripts, but you can make them not "visible by default" so they are there but not seen by the user (and taking up no space).

Using the search module to display entries based on custom fields

I have a profile weblog that contains all our users details (fields seperate from the membership).
These users can submit application forms with the use of a SAEF (stand alone entry form), which will be stored in an applications weblog. Inside this applications weblog, I have a relationship field which assigns a profile to an application.
Inside this application, radio buttons are contained to allow an admin to change the status of that application (an example, a judge views an application for Joe Bloggs and sets this application to “winner”).
What I essentially need to do is filter out all the profiles that have not been set to a number of status’. So if I apply for an application and the judge is yet to view this application, my profile should not appear in the search results. My idea of this is that I would somehow have to intertwine search results with a reverse related entry tag, and as my knowledge of the search module is limited I am at a complete loss if this is even possible.
As you can see, not only do I need to search by custom field, but the profiles that will be displayed should be determined on custom fields contained in the application entry.
I would suggest using the "status" option instead of the radio custom field.
Why? Because you can accomplish the same thing you want to do with the radio field and you can set what entries you want to return in your search results.
For example, you have a status group called: "Application", which is assigned to the that weblog/channel
Within the status group, you will have three options: Pending (waiting to be looked at), Loser (judge sets it to this because it is not a winner, or just as pending), Winner (judge considers that application a winner).
Then in the search tag, you would set what statuses it will return in the search results
so if you want to only return applications/profiles that were marked winner, you would set the status="status_id" (this will be the id of "Winner" status)

How to get distinct values of a managed property through SharePoint search?

I am building a phone catalog of my organization (an AJAX application which accesses the search.asmx web service).
I'd like to show a list box where the user could select a department (which is stored in managed property Department). To fill the list box with values, I need to somehow select all the distinct values of that property.
Is it possible through search.asmx web service?
What I've found:
an article, which states that it is possible, but it does not use the web service interface
a Microsoft's white paper which states that "If the protocol client specifies at least one property, it MUST also specify the Path property. If it does not, the protocol server MUST return the status code "ERROR_BAD_QUERY"."
The two findings are somewhat inconsistent. (and, yes the search really returns ERROR_BAD_QUERY).
Why bother to check with the web service or complicate it?
Get all the properties into a DataTable.
Then create a DataView & then you can apply the DISTINCT on required column.
Finally use it to bind to your list box.

Resources