How to Add ContextMenu Item to Mturk Requester - google-chrome-extension

I'm writing a Chrome Extension and I need to add an item the context menu when right clicking a requester on the Mturk HIT Groups window. I've read how to add context menus but nothing seems to apply to adding an additional context item to an existing menu or how to connect that menu to my addition. Can someone point me to some documentation on how to accomplish that? TIA.
After a little more research I came up with this code:
chrome.contextMenus.create({
id: "autoselectid",
title: "Auto Select",
contexts: ["browser_action"],
parentId: parentid
});
This doesn't work as I get the error:
Unchecked runtime.lastError: Cannot find menu item with id 2037286881
Since I can't find that error in my context, I don't know where to go from here.

I don't know anything about MTurk but to add an new item to an already existing context menu you have to use chrome.contextMenus.create passing a new id and optionally the parentId as parameters (if that new item is nested inside another)

Related

How to customize Sales Order form with SuiteScript 2.0?

I didn't find any documentation on advanced customization.
I need to customize Sales Order in a more advanced way than basic customization offered in UI Customization Menu.
For example, add some sublists under Item section with a relation one to many between Item and Messages (1), or add a new button to display a new page to create a messages record page linked with the selected item (2).
Thank you!
Explicative Screenshot
NetSuite's current API does not accommodate the use of custom buttons inside sublists (unless you are using the native REFRESH or MARKALL button within a custom Suitelet).
An alternative solution to bridge the gap between the item record and the message record you want to create, why not do the following:
First, create a SUITELET which opens as a CHILD window of the current window on FIELDCHANGE of the item.
Second, add a basic TEXTAREA field and include the SUBMIT button to the suitelet.
On SUBMIT of the Suitelet, ccreate a new message record, attaching it to the current sales order.
Lastly - ensure the Suitelet closes itself.
Note: This solution will only work on EDIT of a sales order. It will not work on CREATE because no order ID would exist at the time you submit a message. (You need the order ID to attach the message to).
I hope this suggestion is clear.
You can do your customization on BeforeLoad in a UserEvent script : you can access the current form from the context and do somethings like adding buttons, sublists, hiding fields...
You can not add a button, but you can add a link pointing to a Suitelet where you can execute your actions. As an example, I created a sublist with a View link that points out to the line's custom record:
To define the field:
var idField = appStepsSublist.addField({
id: 'id',
type: serverWidget.FieldType.URL,
label: 'View'
});
idField.linkText = 'View';
To set Value :
var viewUrl = url.resolveRecord({
recordType: 'customrecord_nab_approval_step',
recordId: appStep.id,
isEditMode: false
});
usedSublist.setSublistValue({
id: 'id',
line: index,
value: viewUrl
});
In your case, you can use the URL module to get a Suitelet link and append to it the needed data from your current line.

Kentico 9: Auto Add Binding in Custom Module

I have created a custom module (actually I have created a handful in recent years, and this same obstacle frustrates me every time) following the Kentico documentation:
https://docs.kentico.com/display/K9/Creating+custom+modules
The problem I end up with every time, is in developing the User Interface for Parent/Child classes. I create a Vertical Tab node, and beneath it I add an edit tab and a Binding tab for the child class. This all works, and I can add and remove bindings at will, but what I can't do is ADD a new child class and bind it.
Using the Standard Edit Binding template, I am able to bind EXISTING Job Titles to the selected Category, but I cannot CREATE a new one from that page:
To solve this, I created a custom Edit Binding template, and added a New Child Class Header Action that points to a New / Edit Object child:
Which gives me a button that I can use to add a new child class (Job Title):
This approach works per se, in that I can click the New Job Title button and create a new item on the subsequent page:
But no binding is created to link the child object (Job Title) to the selected parent object (Category), An even bigger problem is that once I click Save, I am presented with the following:
The new object DOES SAVE, but the post-save navigation is somehow failing. The event log offers little in the way of diagnostics:
So I thought to create a completely custom interface to accomplish my needs here, according to the Kentico documentation:
https://docs.kentico.com/display/K9/Manually+creating+the+interface+for+custom+modules
So I change the Element Content of the New Job Title page to a custom page that I created to post a DataForm for the new object:
Taking care to assign the proper Object Types on the Properties Tab:
The intent was to programmatically create the binding upon save and also handle the correct navigation to avoid the ambiguous parameter error above, but when this page loads, the UIContext.ObjectID and UIContext.ParentObjectID are both 0:
So I cannot create the binding programmatically. I was able however to solve the error that I received by manually assigning the redirect. The experience is still lacking even with this hack, since it returns to the listing page, but the user still has to click "Add Items" to assign the binding after successfully creating it with the custom page I built.
This cannot be the proper way to do this, so any help with getting me on the right track would be greatly appreciated.
In order for the EditedObject to have a value you have to either decorate the page with the EditedObjectAtribute e.g. like this:
[EditedObject("<custom.objecttype>", "<objectid>", ...)]
or set the object yourself:
int objectId = QueryHelper.GetInteger("objectid", 0);
EditedObject = SomeInfoProvider.GetSomeInfo(objectId);
In your case, I'd recommend exploring what query parameters are available on the page and using them to fetch appropriate object(s). Also, make sure "JobCategoryId" is passed to the "New Job Title" dialog so that you can create the binding.
Btw - kudos for well asked question!

TestComplete Menu Item

I am new to TestComplete. I have a question and it may be something impossible or too simple. I have a toolbar containg File, Edit, View, etc. I want to get one item (eg. Edit) to mapped objects. I can get the whole toolbar only. I want to simulate a click event on Edit. How can I do this?
As a rule, TestComplete does not work with menu items as with separate objects. It works with a menu object or even only with a menu's parent object and you can specify which item to select by passing the caption of this item to the corresponding method of a menu object. For example:
objMenu.Click("Edit|Paste");
// or
parent.MainMenu("Edit|Paste");
Please find more details on how TestComplete interacts with menus in the Working With Menus help topic.

Hide CRM form left hand side navigation item

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.

How do I read the value of context menu checkbox?

I'm trying to create a Chrome extension that a user might want to frequently enable/disable. To facilitate this, I'd like to add a checkbox to the context menu that basically says "extension enabled". When a page loads, it would check to see if there was a check by the context menu item. I have created the menu item, and it stays persistent throughout page loads, but I don't know how to read its value. Can anyone help me out?
Here is the code that I'm using to add the checkbox to the context menu.
var checkbox1 = chrome.contextMenus.create({
"title": "Enable",
"type": "checkbox",
"onclick":enableAutofilter
});
From the Chrome docs, it appears that there is no way to read information about a context menu item. There are create, update, and remove functions, but no read function (so it has only three of the CRUD operators). This means that you'll have to maintain the on/off state elsewhere, e.g., on your background page and/or in localStorage, and toggle it when you fire enableAutoFilter.

Resources