Display an option set for a field based on selection of previous field - crm

I have a option set column called "Business Unit" in Micrsoft Dynamics CRM and the options are
"Edge"
"Core"
"Cloud"
Then I have another option set column called "Business category" and the options are
"Hardware"
"Software"
"Services"
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
If I select "Edge", then only "Hardware" should pop up
If I select "Core" then "Hardware" and "Software" should pop up
If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
We are trying with JScript in CRM, but it is showing some error. Can anyone help me out how to write a script to achieve this process. I have to do this on priority.
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
If I select "Edge", then only "Hardware" should pop up
If I select "Core" then "Hardware" and "Software" should pop up
If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
I tried writing using array but its showing error.
My code: -
var B_line_arr = window.B_line_arr || {};
(function() {
this.formOnLoad = function (executionContext){
var formContext = executionContext.getFormContext();
var businessarea = formContext.getAttribute("new_buniessarea21").getText();
var businessline = formContext.getAttribute("new_buniessline21")
if(businessarea=="Edge")
{
var arr = [{value: 100000000, text: 'Hardware'},
{value: 100000001, text: 'Software'},
{value: 100000002, text: 'Services'}];
for(var i=0;i<=arr.length;i++)
{
businessline.clearOptions();
businessline.addOption({value: arr[0].value, text: arr[0].text});
}
}
}
}).call(B_line_arr)
```

Related

validate one dynamic field on the basis of dynamic checkbox in vue using yup

I am using composition api in vue, I have dynamic fields what i want to is to validate one dynamic field on the basis of other dynamic field with yup
this is dynamic field one
<Field
type="checkbox"
class="form-check-input form-check-sm "
:name="`sku[${index}].cross_dock_check`"
:id="`sku[${index}].cross_dock_check`"
/>
this is my second dynamic field
<Field :name="`sku[${index}].pickup_address`" v-slot="{ field }" :value="store.pickup_address_id">
<Multiselect v-model="field.value"
:searchable="true"
v-bind="field"
:options="add_sku_data.get_pickup_addresses"
placeholder="Address"
></Multiselect>
</Field>
what i want to do is if the
checkbox[0] is checked then the pickup_address[0]
checkbox[1] is checked then the pickup_address[1]
is required and so on, this is my validator
const orderbookingformValidator = Yup.object().shape({
order_type: Yup.number().required().typeError("Order Type is required"),
courier_type: Yup.number().required().typeError("Courier Type is required"),
//sku_courier: Yup.number().required().typeError("Courier Type is required"),
city: Yup.number().required().typeError("City is required"),
consignee_name: Yup.string().required().label("Name"),
select_shipping: Yup.string().when("order_type", {
is: value => value == 5 || value == 6,
then: Yup.string().required().label("Shipping"),
}),
email: Yup.string().required().label("Email").email(),
address: Yup.string().required().label("Address"),
phone_number: Yup.string().required().label("Phone Number"),
phone_number2: Yup.string().required().label("Phone Number # 2"),
cod_amount: Yup.number().required().label("COD Amount"),
shipping_mode: Yup.number().required().label("Shipping Mode"),
courier_charges_mode: Yup.number().required().label("Courier Charges Mode"),
order_id: Yup.string().required().label("Order ID"),
spacial_instruction: Yup.string().required().label("Spacial Instruction"),
packaging_instructions: Yup.string().required().label("Packaging Instruction"),
product_counter: Yup.number().required().min(1, "At least one product is required"),
});
so how should i be able to add condition , that address is required only if the checkbox is checked
I know that
const schema = Yup.object().shape({
checkboxName: Yup.boolean(),
address: Yup.string().when("checkboxName", {
is: true,
then: Yup.string().required("Address is required."),
}),
});
works for the single field validation , but how to do it for dynamic fields?

Where does the inLineKeyboardButton respond when the user clicks on it

enter def start(update: Update, context: CallbackContext) -> None:
"""Sends a message with three inline buttons attached."""
keyboard = [
[
InlineKeyboardButton("Option 1", callback_data='1'),
InlineKeyboardButton("Option 2", callback_data='2'),
],
[InlineKeyboardButton("Option 3", callback_data='3')],
]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Please choose:', reply_markup=reply_markup) here
I know that 'Option 1' is the name that the button displays and callback_data is the data that is called back in, but ยท I don't know where this InlineKeyboardButton will respond to the pressed event,Or in which function will this callback_data be passed to be executed?
You need to use handler to get callback data
updater = Updater(token, use_context=True)
dp = updater.dispatcher
dp.add_handler(CallbackQueryHandler(c_back_respons))
then you can use function like this
def c_back_respons(update: Update, context: CallbackContext):
call_back_data = update.callback_query.data
if call_back_data in ("1"):
function(update)

Accessibility for pickerview Voice Over

I need some help, I'm trying to finilize my first application and now I'm implementing the accessibility in orther the application can be used with VoiceOver.
The issu is I have 3 different pickerviews in one view controller but I cannot fix a label for each of them. The properties in the inspector identifier don't work for pickerView. If i use the method:
func pickerView(_ pickerView: UIPickerView, accessibilityLabelForComponent component: Int) -> String?
yes, I fix a label but it is the same for the three of them and I ineed each pickerView have its own label. Each pickerview have one component, but I don't know how to set up in other to differenciate each pickerView and have three different labels, one for each of them.
Any help is wellcome
Many thanks by anticipate
I include here the next:
1st.- a screenshot of one the pickerview selected and how its label in the inspector is setup, but it doesn't work at running:
a screenshot of one the pickerview selected and how its label in the inspector is setup, but it doesn't work at running:
2.- the code used for any other control, label or text field which work for them but not for the pickerview:
extension Rithm {
func applyAccessibility() {
logo.isAccessibilityElement = false
kmMille.subviews[0].accessibilityLabel = NSLocalizedString("Milles", comment: "")
kmMille.subviews[1].accessibilityLabel = NSLocalizedString("Kilometers", comment: "")
switch kmMille.selectedSegmentIndex {
case 1:
distanceTextField.accessibilityLabel = NSLocalizedString("Please, enter a distance in Milles", comment: "")
case 0:
distanceTextField.accessibilityLabel = NSLocalizedString("Please, enter a distance in Kilometers", comment: "")
default:
break
}
hourPickView.accessibilityLabel = NSLocalizedString("Time selector, enter the hours used for the distance selected", comment: "") // DON'T WORK
}
}
3rd, the method used with the pickerview which work if you add one label and it is returned for all the pickerview in the view controller, however, I don't know how to fix here to add one label for each of them.
func pickerView(_ pickerView: UIPickerView, accessibilityLabelForComponent component: Int) -> String?{
hourPickView.accessibilityIdentifier = "Hour"
secPickView.accessibilityIdentifier = "Sec"
minPickView.accessibilityIdentifier = "Min"
switch component {
case 0:
print("Este es: \(component)")
if hourPickView.accessibilityIdentifier == "Hour" {
switch pickerView.accessibilityIdentifier {
case "Hour"?:
return "Box for hour"
case "Min"?:
return "Box for minute"
case "Sec"?:
return "Box for second"
default:
return "Doesn't work"
}
//return "try to check what happens"
} else {
return "doesn't work"
}
default:
print("\(component)")
return "either"
}
}
As I told you all, thanks for your help!!!

Kendo Dropdown optionLabel changes selected value

I am wondering if anyone can shed some light on why setting an option label for a Kendo Dropdown affects the selected value, and how this can be avoided.
The setup is that I have a select list that's populated by ASP code. The selected value is set in the codebehind.
Everything works fine unless I specify an option label. When I do that, the selected value changes. Here it is in action:
console.log("Value before: " + $("#dropdownlist").val());
$("#dropdownlist").kendoDropDownList({
optionLabel: {
text: "-- Select An Option --",
value: 0
}
});
console.log("Value before: " + $("#dropdownlist").val());
Console output:
Value before: 2
Value after: 1
When I start with value = 3, the optionLabel sets the new selected value to 2.
Thanks in advance for your help.
Here is a fiddle http://jsfiddle.net/vojtiik/VZRwf/1/ showing that the ddl maintains the selection. My console says 3, 3, 3. The reason why you getting different values is because your first log refers to different control.
var $select = $('#size');
$select.val(3);
console.log($select.val()); // 3
var ddl = $('#size').kendoDropDownList({
optionLabel: {
text: "-- Select An Option --",
value: 0
}
}).data("kendoDropDownList");
console.log($select.val()); // 3
console.log(ddl.value()); // 3

calling an event on a Button in datawindow

I have placed a search button on a datawindow, and i have already an event for searching such list...how is it possible to call an event once the button is clicked on runtime.
below is the code on my event named "ue_key"
string xcode, iseries, ycode, sql_statement, xname, i_cname, name, iseries_no, irequested_by, irequest_problem, irequesting_dept, idate_request, idate_needed
string iasset_no, idate_received, istatus
long i_row
//integer
i_cname = dw_work_order.getcolumnname()
i_row = this.getrow()
if i_row > 0 then
if key = keyF2! and i_cname = 'series_no' then
//open(w_csearch)
// Then, define select statement
sql_statement = "SELECT series_no as 'Series NO', requested_by as 'Requested By' FROM work_order_form where status = 'A' or status = 'ACTIVE';"
str_sellist args
args.trans = sqlca
args.sel_cmd = sql_statement
// Specify which column will be the return value
args.retcol = 1
// Define drop-down items. NOTE: This should correspond
// with the alias you use for the columns you retrieve
args.dropdown_items[1] = "Series NO"
args.dropdown_items[2] = "Requested By"
// Define Search Window Title
args.title = "Work Order"
// Define transaction object for the window
// This is REQUIRE for now... :)
// Open with parameter
OpenWithParm(w_sellist, args)
ycode=message.stringparm
xcode = ycode
// MessageBox('test', xcode)
if trim(xcode) <> '' then
select series_no, requested_by, request_problem, requesting_dept, date_request,date_needed, asset_no, status
into :iseries, :irequested_by, :irequest_problem, :irequesting_dept, :idate_request, :idate_needed, :iasset_no, :istatus
From work_order_form where series_no = :xcode using sqlca;
// Messagebox('test', iseries)
this.setitem(THIS.GETROW(),'series_no', iseries)
this.setitem(THIS.GETROW(),'requested_by', irequested_by)
this.setitem(THIS.GETROW(),'request_problem', irequest_problem)
this.setitem(THIS.GETROW(),'requesting_dept', irequesting_dept)
this.setitem(THIS.GETROW(),'date_request', idate_request)
this.setitem(THIS.GETROW(),'date_needed', idate_needed)
this.setitem(THIS.GETROW(),'asset_no', iasset_no)
this.setitem(THIS.GETROW(),'status', istatus)
//dw_work_order.retrieve(iseries)
end if
end if
end if
Thanks a lot!
The datawindow control has "ButtonClicking" and "ButtonClicked" events. You can use these event to identify which button was clicked (check the event arguments, specifically dwo.Name) and call the appropriate code.
You'll want to make sure that your datawindow button's action is set for "User Defined (0)".

Resources