Add a custom field to jira (create issue) with a plugin - plugins

I'm wondering if theres a possibility to add a Custom Field (A Textfield for ex.) to the Create Issue Screen (Default Screen). I already managed this by using the Web-GUI, but now i want to do this with a plugin.

Here's how to add existing custom field to existing screen from your plugin code:
FieldScreenManager fieldScreenManager = ComponentAccessor.getFieldScreenManager();
FieldScreen screen = fieldScreenManager.getFieldScreen(screenID);
FieldScreenTab defaultTab = screen.getTab(0);
defaultTab.addFieldScreenLayoutItem(customFieldID);
Check FieldScreenManager and FieldScreen javadocs for detailed info.

Related

Can I change "OK" button style in Select Dialog to emphasized?

anyone know if sapui5 provide solution/function to change button style in select dialog? I've checked the SAPUI5 sdk but there is none for this solution.
If you are OK with using "private" properties then you can use _oOkButton property of SelectDialog or else you can use _getOkButton function which also is kind of "private" and returns ok button instance.
Just use the instance of the Select Dialog and get all buttons using the following methods. Select Dialog is a dialog only, you can use the methods of sap.m.Dialog
Let say you have the instance of the dialog as oSlectDialog then
oSlectDialog.getButtons() - will return all the Buttons in the footer. You can use loop them and give custom class accordingly.
var oBtns = oSlectDialog.getButtons()
for(var b in oBtns) {
var oBtn = oBtns[b];//You can check for button instance, if you want to add custom class differently.
oBtn.addStyleClass("YourCustomClass");
}
You can also use the sap.m.Dialog methods like oSlectDialog.getBeginButton(), oSlectDialog.getEndButton().
Since UI5 1.62.0, the primary action OK (later renamed to Select) is automatically emphasized if the theme is sap_fiori_3.
https://openui5.hana.ondemand.com/#/entity/sap.m.SelectDialog/sample/sap.m.sample.SelectDialog
If it's not urgent, I'd suggest to avoid relying on private methods/ properties, but update to the latest UI5 version and themes.
Update: and since 1.70 (commit:1f421b0), the button is automatically emphasized in other supported themes too, such as sap_belize, sap_belize_plus
Related Github issue: https://github.com/SAP/openui5/issues/2254

not able to register two plugins of touch-ui rte dialog

I am using the steps given in the URL to make a color-picker rte plugin
http://experience-aem.blogspot.in/2015/01/aem-6-sp1-touchui-richtext-editor-color-picker-plugin.html
and at the same time I am making another custom rte plugin to do some text modulation.
But only one of them is working using rte.coralui2 as categories.
and both icons are coming at the same location.
If I disable one js then another is working.
I have registered the plugin with different name and I have also used different variables.
I am not able to make the rte plugin button at different location.
Please suggest the possible solution.
it's possible you are overlaying rather than extending the rte.coralui2 category. I suspect your custom clientLibs are competing with each other and only one is available.
It seems like you are using the same steps provided in the blogpost for creating both the plugins and while doing that, you are using the below code twice with different icons :
if(items.indexOf(ExperienceAEM.TCP_UI_SETTING) == -1){
items.splice(3, 0, ExperienceAEM.TCP_UI_SETTING);
}
So, maybe, the icons are being added at the same place and only one of them is shown.
You should create ExperienceAEM.CuiToolbarBuilder Class only once and add both icons inside that class

Change menus and menu items programmatically in Eclipse E4

I am having trouble removing existing menus from the model, in a running app.
For example:
MMenu menu = modelService.findElements(app, "idMenuFoo", MMenu.class,
Collections.<String>emptyList(), EModelService.IN_MAIN_MENU).get(0);
menu.setLabel("X");
menu.setVisible(false);
menu.setToBeRendered(false);
After this code gets executed:
The label has been changed to 'X'
But the menu entry is still visible/rendered
If I start the app without clearPersistedState, then restart it, the menu has disappeared. This leads me to be believe the the visibility and rendering attributes were set in the first place, but not applied to the model (unlike the label attribute).
How can I programmatically trigger a main menu bar "refresh" after such changes?
As a Greg in the comment above posted, there is an open bug filed to address this issue. An easy to implement a workaround involves manually refreshing the underlying SWT menu. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=365724#c9 for details. In a gist:
// retrieve the main menu, containing the top-level menu element that needs to be refreshed
MMenu mainMenu = ...
// org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer
MenuManagerRender renderer = (MenuManagerRenderer)mainMenu.getRenderer();
renderer.getManager(mainMenu).update(true);

SugarCRM installable changes in detailview

I have a simple problem but may be serious for me , I made custom fields and added them all in the custom\modules\Leads\metadata\detailviewdefs.php (detailview layout) of Leads module but problem is that i have to make a installer package of changes. I managed with custom fields and copied them in the custom\Extension\modules\Leads\Ext\Vardefs through manifest. Now i don't know how to apply detailviewdefs changes through manifest (add new fields panel in detailview). The point is that the existing detailview layout should not be changed but only add a new panel in it.
Possible solution in my mind is like I should add code in $layout_defs array $layout_defs["Leads"]["DetailView"] ['panels']['panel_name'] and place it in custom\Extension\modules\Leads\Ext\Layoutdefs\ and copy Layoutdefs file through manifest. I tried this but not seems working one.
Looking for a smart solution share if you can.
Addition:
Even if i export module changes from Studio ->export Customizations and import in other instance with module builder. It override all the previous custom files(customizations) in newer instance (Is it not a limitation in SugarCRM) but my requirement is to add only changes in newer instance's detailview.
That's a tough one. There are two options that I know of. 1) Provide directions to the user for how to add the fields to the layouts using Studio 2) In a post_install.php script mimic how a Studio layout deploy works to insert your fields into any given layout (best practice would be to create a new panel for all of your fields if mass distributing).
I had found following functions of sugar's ModuleInstaller class to add or remove fields from layouts through manifest script. These functions will add/remove fields to both editview and detail view at the same time. Just add following lines in post_install / pre_install no need to require anything,
$installer_func = new ModuleInstaller();
$layoutAdditions = array('Users' => 'users_access');
To add users_access field in Users module:
$installer_func->addFieldsToLayout($layoutAdditions);
To remove users_access field from Users module:
$installer_func->removeFieldsFromLayout($layoutAdditions);
Hope it's helping.
mansoor

Want to display an auto generated id in a custom module of SugarCRM

I am using Sugar Enterprise 6.4.0 and want to display a uneditable field in a custom module Edit and Detail view. This id need to be generated automatcially and need to be displayed in the interface when user click to create a new record in the custom module.
Because i am new to Sugar can anyone help me out in performing this task. Any ideas?
You can set the readonly property on the field itself in the vardefs for the module...
$dictionary['<<module>>']['fields']['<<fieldname>>']['readonly'] = true;
Then, add some logic in the custom/modules/<>/views/view.edit.php which does the autogeneration for you.
I just did this, using an after_save_hook with code like(not exact):
$bean->name = $bean->id;
as soon as you save a record in sugar an id is generated automatically. Then I don't include the ID in the editview at all, just the detail and list views. I don't see any point in including it in the edit view as it is not editable.