Hi All,
I'm trying to add two custom fields(date type& pull down text type) in My Opportunities App.
I can load and edit custom fields.
But I can't save custom fields for new opportunity.
I'm trying to code S5Custom.controller.js and opportunityCreateContentBottomExtensionCustom.fragment.xml.
*S5Custom.controller.js *
(the function is overwritten)
fill_dropDowns: function(s) { /** overwrite function */ /* for custom field*/ var g = new sap.ui.model.json.JSONModel(); var h = { SalesIntentions: [{ LanguageCode: "JA", ProcessType: this.processType, SalesIntention: "", }] }; for (i = 0; i < 3; i++) { h.SalesIntentions.push({ LanguageCode: "JA", ProcessType: this.processType, SalesIntention: ""+10*(i+1)+"", }) }; g.setData(h); this.byId('salesIntention').setModel(g, "json"); }, dataConfirm: function(r) { /** overwrite function */ //custom var o = new Date(f.parse(this.byId('datePickerCompletionDate').getValue())); var f = o.getFullYear() + "-" + (o.getMonth() + 1) + "-" + o.getDate() + "T00:00:00"; var E = { //custom CompletionDate: f, //custom SalesIntention: this.byId('salesIntention').getSelectedKey(),
*opportunityCreateContentBottomExtensionCustom.fragment.xml*
<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:ui="sap.ui.layout" controllerName="cus.crm.opportunity.view.S5" xmlns:ca="sap.ca.ui" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:custom="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"> <ui:form.SimpleForm id="form8" minWidth="1024" maxContainerCols="2" editable="true" layout="ResponsiveGridLayout" labelSpanL="3" labelSpanM="3" emptySpanL="4" emptySpanM="4" columnsL="1" columnsM="1" class="editableForm"> <ui:content> <Label id="completionDateLabel_S5" text="{i18n>COMPLETION_DATE}"> </Label> <ca:DatePicker id="datePickerCompletionDate" ></ca:DatePicker> </ui:content> <ui:content> <Label id="salesIntentionLabel_S5" text="{i18n>SALES_INTENTION}"> </Label> <Select id="salesIntention" items="{json>/SalesIntentions}" class="pos_input"> <items> <core:Item key="{json>SalesIntention}" text="{json>SalesIntention}"> </core:Item> </items> </Select> </ui:content> </ui:form.SimpleForm> </core:FragmentDefinition>
1.New Opportunity
2.Select Save
3.Check Custom fields. Custom field can't save
4.Debug: the custom fields is stored in object
Kindly advice me proceed further.
Best Regards,
Yuki