Hide CRM form left hand side navigation item - dynamics-crm-2011

I have my account entity linked to a custom entity called inspections, I only want these inspections to be created for accounts of a certain type. So when it isn't that type I want the left hand navigation to this entity to be hidden away. I've seen some code that says will hide it away, as long as you have the navID of the item.
I've had a crack at hiding it using what i thought could be the ID but it hasn't worked, so I'm wondering if anyone knows how to get this ID, or if there is another way to do this?
The code I'm using to hide the navigation is below:
var navitem = Xrm.Page.ui.navigation.items.get("nav_ts_inspection");
if (navitem != null)
{
navitem.setVisible(false);
}

Load the form
Press F12 to show IE Developer's Toolbar
From here you can use CTRL+F to search for the display name of the item you'd like to hide. This will give you a link that is generated. The Id of this element is what you need to use to show/hide the link.
As an example, you can see results of searching for 'Sub Accounts' on the Account screen for an installation I am working on at the moment. The Id can be seen and is 'navSubAct'

Changes by traversing DOM and manually hide an area is not officially supported.
Luckily if you are on CRM 2011, you can go to
Settings > Customization Or open the solution.
Select the entity > Forms. Inside the Form editor window, open the Form Properties of the entity.
Go to Display Tab and untick "Show navigation items" checkbox.
Finally do not forget to Publish your changes.

Use the relationshipname to hide folder in navigation like this:
If you have folder with the relationship name: ts_inspection
Use this for ID: navts_inspection
So otherwise the same as above, but lose the extra underscore (_) between nav and ts.
var navitem = Xrm.Page.ui.navigation.items.get("navts_inspection");

If you want to hide particular navigation section from the FORM then remove all the links from that section and publish it. That section will not be visible anymore.
If you want to just remove Navigation Pane from FORM, then go to 'Display' tab of form and mark as 'Do Not Show' and then publish it.

Related

How to hide URL Selector content tab?

I am creating a custom webpart using the Url Selector from kentico. I want the user to select content just from the Media Library. I went to form controls -> Url Selector -> Properties -> Dialogs_Content_Hide -> Default Value -> Yes and it still showing it in the Web Part. If I select the Dialogs_Web_Hide, Dialogs_Libraries_Hide and select the yes option in the default values, they hide, all except the Content_Dialogs.
Is this a bug? Or its something wrong?
Here is an example of the tabs
First set the form controls properties back to the way they were. If you don't, it will cause all kinds of problems later on.
Secondly, when you create the property in the webpart in the UI, select the URL selector form control for your text fields control. The scroll down just a bit and under the Editing Control Settings you'll see an "Configure" link. Click it. In there you will be able to tell the form control what tabs you want to enable and disable.
To add to Brenden's answer; if this is something you need to do a lot for your current build, then I'd also suggest making a copy of the Url selector form control and customize the properties as you originally mentioned. This way, you leave the default control in place for the system and have a control tailored to your needs. I've done this just now to check with a new form control that I called Media URL selector. Do make sure that you select the same source file as the original control in the Cloned form control file name property - Kentico by default will try to locate a new file called <original filename>_1.ascx. The reason for this is that admin section of your site also makes use of this control, so you may cause a nasty side effect somewhere else in the system.
As for why the settings had no effect; these are the default values you are setting. If you already have the form control in use, then the default setting would have been applied as they originally were. If you find one of the fields in question, you can change the control type to Text box, click Save, and then reassign it to Media URL selector.

Why can't Acumatica find a view?

I created a DAC extension mapped to an extension table off of SOShipment. I have two custom fields in the extension table that I'd like to add to the Sales Orders entry form, specifically the grid in the Shipments tab. When I go to the layout editor for this form and select the Grid: ShipmentList under the Shipments tab, there are no fields in the Add Data Fields tab on the right. Also, I see a yellow circle with this error in several places:
The "ShipmentList" view is not found. Try to publish the customization project.
I published the customization project, but the error persists. To my knowledge, we haven't done any customization that would've touched the ShipmentList view. What is the issue here and how do I resolve it?
Since you are trying to add those Custom fields to the Grid: ShipmentList(which primary DAC is SOOrderShipment), make sure you add the Custom Fields to the Correct DAC extension, the correct DAC extension should be for SOOrderShipment.
(You have to rename the DataView because in base code, this Dataview is named shipmentList. However, the editor Tool when generating Customization Script for that screen is assigning ShipmentList(Capital S) to Datamember instead of correct Dataview name. )
So, then Go to Section Screen, Select SO301000 screen, select the Grid(ShipmentList) under the Shipments Tab, select Action->Edit ASPX, then locate on DataMember="ShipmentList" (with Capital S) and replace it for DataMember="shipmentList" (lowercase s). Then click on "Generate Customization Script" and publish your Customization.
After publishing, go to SO30100 Screen, select correct Grid and you will be able to see new Custom Fields and the warning message gone.

How to create a NotesRichtext item that is computed for display?

I know this is a common problem, and I tried a few solutions already, but the problem I have right now with my current code is that even though the attachments show in the computed for display field, I get the error "Note Item not Found" when I try to open them.
The form is built with two fields, in a programmable table that displays the editable one or the computed for display one.
The trick I found with Google's help was to delete the computed for display item in the queryopen event, so Notes regenerates the cfd item when opening the document. Visually, this works, as I see the text and attachments, but the attachments can't be opened.
Here is the code that removes the item in the QueryOpen of the form:
...
Set item = doc.GetFirstItem("dspDescription")
If Not item Is Nothing Then Call item.Remove()
...
Has anyone successfully achieved that functionality? Is there another way of doing this? I already tried with subforms, and because of the way the application is built, I need to be able to switch from editable to read only on the flick of a radio button, so subforms are out of the question as they can't be displayed dynamically.
Why don't you simple put the richtext item in a controlled access section and make that section editable / not editable with a computed for display formula. Select "always expand" and hide the section title, so that nobody can collapse it, et voila.
Regarding your comment: With this properties:
for this section in designer:
You get this result:
You see: No twisty, no "visible" section

Browser add on/extension to intercept data selection then simulate link click and data entry

Background: a third party web application with a requirement on the order page to explicitly guide staff when a certain category of product is ordered.
Normal process:
select product to add order line (click on product image)
New process:
select product to add order line (click on product image)
[add on] simulate click on edit order line
[add on] simulate clear of default additional information form fields
enter additional information and click save
Note that the two steps to be performed by the add-on could be performed by the user however when things get busy or new staff begin is often the case that the order gets processed with the default value.
Any pointers in the right direction would be appreciated.
A multi-browser solution is preferred but not essential.
I am an experienced developer, including web development, but have no experience in browser add on/extension development.
Thanks.
You can make an addon out of this very easily. You addEventListener to the gBrowser and if the event.target is the product element then preventDefault so the click doesnt go thru (you will have to do mousedown and mouseup prevent as well). Then rather get the id of the "edit order line" and do .click() if that doesnt work and you really need to simulate use MouseEvent:
MDN :: MouseEvent
MDN :: Initatite/Dispatch MouseEvent
To enter aditional information get the id of the fields, and set their value. Then get the "Save" button id and then do .submit() or .click()
i said do get id in this post but you can use querySelector and go by css selector
see this page here on how to interact with content in currently selected tab:
https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser
basically just do gBrowser.contentDocument.getElementById

Best practice in dealing with xpages extensions dialog box?

I have an extension pages dialog box that I placed in a custom control. The dialog box is used to search for cost centers and return information such as market, cost center number, cost center name etc.
A "Select" button is pressed and the dialog box appears. The user searches for and selects their cost center. The OK button is pressed and it closes the dialog box and updates the various fields on the xPage.
A couple of questions.
Currently the "Select" button on the CC needs to know and refer to the name of the dialog box control within the CC. Seems to me that this is not the best practice. My end user programmer needs to know the ID of that dialog box control within the CC. Is there any way for my "Select" button could "show" the CC and the CC would actually show the dialog box control?
My CC makes use of custom properties to store the various document fields from the selected cost center. The OK button then uses these properties to set the various fields on the xPage. This again does not seem to be a best practice. If I wanted to use that CC in another application then I might need to edit the code in the OK button. Is there a better way to deal with this? Like I can set properties for a CC when I drop it on my xPage, is there a way I can tell it the code that I want to execute when the OK button is pressed?
One thing I thought was to have properties for the fields that need to be updated by the OK button but that does not seem to be so flexible.
For the issue of needing to know the id not sure if theres a typo but I don't understand why its bad that a select button inside a cc needs to no the id of the dialog to open it? did you mean the select is outside the cc? either way have you tried anything like creating a property on the custom control so that from outside it you can set something maybe
<xc:mycustomControl showDialog="false">
and then when something outside it happens change showDialog and refresh the cc, then inside the cc you can have a before / after page load to determine what happens when showDialog is true / false.
For your second issue it sounds to me like this should be using a domino document structure. Rather than the dialog pulling out each piece and the ok button updating, what I would do is have a domino doc data source on the page. when something is selected through the dialog I would update the document this source is pointing to and have all the fields bound to what ever fields they need to be. This way after something is selected the fields will just update to what ever the document contains, and it will be much more re useable so long as the domino docs have the same field names

Resources