Unable to auto accept Room - Meeting Exchange 2013 - outlook

I've been working on this for the last couple of day and I'm out of ideas.
I have two rooms, both reasonably new rooms as well. Both need to auto accept meetings when free and let the delegate action meetings that are not.
Any ideas?
Here is the one that does not auto accept:
AddAdditionalResponse : False
AdditionalResponse: <DIV><FONT face=Tahoma size=2></FONT></DIV>
AddNewRequestsTentatively : False
AddOrganizerToSubject : True
AllBookInPolicy : True
AllowConflicts : False
AllowRecurringMeetings : True
AllRequestInPolicy : False
AllRequestOutOfPolicy : False
AutomateProcessing : AutoAccept
BookingWindowInDays : 365
BookInPolicy : {}
ConflictPercentageAllowed : 0
DeleteAttachments : True
DeleteComments : True
DeleteNonCalendarItems : True
DeleteSubject : False
EnableResponseDetails : True
EnforceSchedulingHorizon : False
ForwardRequestsToDelegates : True
Identity : corporate.MyDomain/Organisation/Meeting Rooms/MEETINGS - Executive Meeting Room
IsValid : True
MailboxOwnerId : corporate.MyDomain/Organisation/Meeting Rooms/MEETINGS - Executive Meeting Room
MaximumConflictInstances : 0
MaximumDurationInMinutes : 1440
ObjectState : Changed
OrganizerInfo : True
ProcessExternalMeetingMessages : False
RemoveForwardedMeetingNotifications : False
RemoveOldMeetingMessages : True
RemovePrivateProperty : True
RequestInPolicy : {}
RequestOutOfPolicy : {/O=My Domain/OU=CORPORATE/cn=Recipients/cn=GROUP-Delegates}
ResourceDelegates : {corporate.mydomain/Groups/DistributionLists/GROUP-Delegates}
ScheduleOnlyDuringWorkHours : False
TentativePendingApproval : False
And the one that is working just fine:
AddAdditionalResponse : False
AdditionalResponse :
AddNewRequestsTentatively : False
AddOrganizerToSubject : True
AllBookInPolicy : True
AllowConflicts : False
AllowRecurringMeetings : True
AllRequestInPolicy : False
AllRequestOutOfPolicy : False
AutomateProcessing : AutoAccept
BookingWindowInDays : 365
BookInPolicy : {}
ConflictPercentageAllowed : 0
DeleteAttachments : True
DeleteComments : True
DeleteNonCalendarItems : True
DeleteSubject : False
EnableResponseDetails : True
EnforceSchedulingHorizon : False
ForwardRequestsToDelegates : True
Identity :
corporate.My Domain/Organization/Meeting Rooms/MEETINGS - Meeting Room F6
IsValid : True
MailboxOwnerId : corporate.My Domain/Organisation/Meeting Rooms/MEETINGS - Meeting Room F6
MaximumConflictInstances : 0
MaximumDurationInMinutes : 1440
ObjectState : Changed
OrganizerInfo : True
ProcessExternalMeetingMessages : False
RemoveForwardedMeetingNotifications : False
RemoveOldMeetingMessages : True
RemovePrivateProperty : True
RequestInPolicy : {}
RequestOutOfPolicy : {}
ResourceDelegates : {corporate.my domain/Organization/AdminBuilding/Aimee,
corporate.my domain/Organization/Natalie}
ScheduleOnlyDuringWorkHours : False
TentativePendingApproval : False
And the problem rooms mail account settings:
RunspaceId : b097d9c5-e6a3-4bbe-a31a-4391011bc914
Database : SG02
MailboxProvisioningConstraint :
MailboxProvisioningPreferences : {}
UseDatabaseRetentionDefaults : False
RetainDeletedItemsUntilBackup : True
DeliverToMailboxAndForward : False
IsExcludedFromServingHierarchy : False
IsHierarchyReady : True
LitigationHoldEnabled : False
SingleItemRecoveryEnabled : False
RetentionHoldEnabled : False
EndDateForRetentionHold :
StartDateForRetentionHold :
RetentionComment :
RetentionUrl :
LitigationHoldDate :
LitigationHoldOwner :
LitigationHoldDuration : Unlimited
ManagedFolderMailboxPolicy :
RetentionPolicy :
AddressBookPolicy :
CalendarRepairDisabled : False
ExchangeGuid : a008111a-0bfc-4286-a394-8f9e16102413
MailboxContainerGuid :
UnifiedMailbox :
MailboxLocations : {1;a008111a-0bfc-4286-a394-8f9e16102413;Primary;MyDomain.com;df028da7-e5c6-4b64-9450-6f7c53247c91}
AggregatedMailboxGuids : {}
ExchangeSecurityDescriptor : System.Security.AccessControl.RawSecurityDescriptor
ExchangeUserAccountControl : None
AdminDisplayVersion : Version 15.0 (Build 1076.9)
MessageTrackingReadStatusEnabled : True
ExternalOofOptions : External
ForwardingAddress :
ForwardingSmtpAddress :
RetainDeletedItemsFor : 00:00:00
IsMailboxEnabled : True
Languages : {en-AU}
OfflineAddressBook :
ProhibitSendQuota : Unlimited
ProhibitSendReceiveQuota : Unlimited
RecoverableItemsQuota : Unlimited
RecoverableItemsWarningQuota : Unlimited
CalendarLoggingQuota : Unlimited
DowngradeHighPriorityMessagesEnabled : False
ProtocolSettings : {}
RecipientLimits : Unlimited
ImListMigrationCompleted : False
IsResource : True
IsLinked : False
IsShared : False
IsRootPublicFolderMailbox : False
LinkedMasterAccount : NT AUTHORITY\SELF
ResetPasswordOnNextLogon : False
ResourceCapacity :
ResourceCustom : {}
ResourceType : Room
RoomMailboxAccountEnabled : True
SamAccountName : _meetingsEMR
SCLDeleteThreshold :
SCLDeleteEnabled :
SCLRejectThreshold :
SCLRejectEnabled :
SCLQuarantineThreshold :
SCLQuarantineEnabled :
SCLJunkThreshold :
SCLJunkEnabled :
AntispamBypassEnabled : False
ServerLegacyDN : /o=MyDomain City /ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=MAIL02
ServerName : mail02
UseDatabaseQuotaDefaults : True
IssueWarningQuota : Unlimited
RulesQuota : 64 KB (65,536 bytes)
Office : Walker Street Level 2 - P&D Interview Room - Behind front desk, 2nd door on the right
UserPrincipalName : _meetingsEMR#corporate.MyDomain.com
UMEnabled : False
MaxSafeSenders :
MaxBlockedSenders :
NetID :
ReconciliationId :
WindowsLiveID :
MicrosoftOnlineServicesID :
ThrottlingPolicy :
RoleAssignmentPolicy : Default Role Assignment Policy
DefaultPublicFolderMailbox : corporate.MyDomain.com/Users/PFMailbox2
SharingPolicy : Default Sharing Policy
RemoteAccountPolicy :
MailboxPlan :
ArchiveDatabase :
ArchiveGuid : 00000000-0000-0000-0000-000000000000
ArchiveName : {}
JournalArchiveAddress :
ArchiveQuota : Unlimited
ArchiveWarningQuota : Unlimited
ArchiveDomain :
ArchiveStatus : None
ArchiveState : None
IsAuxMailbox : False
AuxMailboxParentObjectId :
ChildAuxMailboxObjectIds : {}
MailboxRelationType : None
RemoteRecipientType : None
DisabledArchiveDatabase :
DisabledArchiveGuid : 00000000-0000-0000-0000-000000000000
QueryBaseDN :
QueryBaseDNRestrictionEnabled : False
MailboxMoveTargetMDB : SG02
MailboxMoveSourceMDB : SG06
MailboxMoveFlags : IntraOrg, Pull
MailboxMoveRemoteHostName :
MailboxMoveBatchName :
MailboxMoveStatus : Completed
MailboxRelease :
ArchiveRelease :
IsPersonToPersonTextMessagingEnabled : False
IsMachineToPersonTextMessagingEnabled : True
UserSMimeCertificate : {}
UserCertificate : {}
CalendarVersionStoreDisabled : False
ImmutableId :
PersistedCapabilities : {}
SKUAssigned :
AuditEnabled : False
AuditLogAgeLimit : 90.00:00:00
AuditAdmin : {Update, Move, MoveToDeletedItems, SoftDelete, HardDelete, FolderBind, SendAs, SendOnBehalf, Create}
AuditDelegate : {Update, SoftDelete, HardDelete, SendAs, Create}
AuditOwner : {}
WhenMailboxCreated : 11/05/2015 1:40:54 PM
SourceAnchor :
UsageLocation :
IsSoftDeletedByRemove : False
IsSoftDeletedByDisable : False
IsInactiveMailbox : False
IncludeInGarbageCollection : False
WhenSoftDeleted :
InPlaceHolds : {}
GeneratedOfflineAddressBooks : {}
Extensions : {}
HasPicture : False
HasSpokenName : False
AcceptMessagesOnlyFrom : {}
AcceptMessagesOnlyFromDLMembers : {}
AcceptMessagesOnlyFromSendersOrMembers : {}
AddressListMembership : {\Default Global Address List, \All Users, \All Rooms}
Alias : pdinterviewroom
ArbitrationMailbox :
BypassModerationFromSendersOrMembers : {}
OrganizationalUnit : corporate.MyDomain.com/Organisation/Meeting Rooms
CustomAttribute1 :
CustomAttribute10 :
CustomAttribute11 :
CustomAttribute12 :
CustomAttribute13 :
CustomAttribute14 :
CustomAttribute15 :
CustomAttribute2 :
CustomAttribute3 :
CustomAttribute4 :
CustomAttribute5 :
CustomAttribute6 :
CustomAttribute7 :
CustomAttribute8 :
CustomAttribute9 :
ExtensionCustomAttribute1 : {}
ExtensionCustomAttribute2 : {}
ExtensionCustomAttribute3 : {}
ExtensionCustomAttribute4 : {}
ExtensionCustomAttribute5 : {}
DisplayName : MEETINGS - Executive Meeting Room
EmailAddresses : {x500:/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=e25bae069a104f269b5a313c1afb5121-MEETINGS -,
SMTP:MEETINGS-ExecutiveMeetingRoom#MyDomain.com, smtp:pdinterviewroom#MyDomain.com}
GrantSendOnBehalfTo : {corporate.MyDomain.com/Groups/DistributionLists/GROUP-P&D Interview Room Delegates}
ExternalDirectoryObjectId :
HiddenFromAddressListsEnabled : False
LastExchangeChangedTime :
LegacyExchangeDN : /o=MyDomain City /ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=pdinterviewroom
MaxSendSize : Unlimited
MaxReceiveSize : Unlimited
ModeratedBy : {}
ModerationEnabled : False
PoliciesIncluded : {}
PoliciesExcluded : {{26491cfc-9e50-4857-861b-0cb8df22b5d7}}
EmailAddressPolicyEnabled : False
PrimarySmtpAddress : MEETINGS-ExecutiveMeetingRoom#MyDomain.com
RecipientType : UserMailbox
RecipientTypeDetails : RoomMailbox
RejectMessagesFrom : {}
RejectMessagesFromDLMembers : {}
RejectMessagesFromSendersOrMembers : {}
RequireSenderAuthenticationEnabled : False
SimpleDisplayName :
SendModerationNotifications : Always
UMDtmfMap : {emailAddress:6338464739328848363384647666, lastNameFirstName:6338464739328848363384647666, firstNameLastName:6338464739328848363384647666}
WindowsEmailAddress : MEETINGS-ExecutiveMeetingRoom#MyDomain.com
MailTip :
MailTipTranslations : {}
Identity : corporate.MyDomain.com/Organisation/Meeting Rooms/MEETINGS - Executive Meeting Room
IsValid : True
ExchangeVersion : 0.20 (15.0.0.0)
Name : MEETINGS - Executive Meeting Room
DistinguishedName : CN=MEETINGS - Executive Meeting Room,OU=Meeting Rooms,OU=Organisation,DC=corporate,DC=MyDomain,DC=COM
Guid : 2f8aab68-23fd-41d0-a9c3-0ece297b016a
ObjectCategory : MyDomain.com/Configuration/Schema/Person
ObjectClass : {top, person, organizationalPerson, user}
WhenChanged : 23/09/2015 2:15:18 PM
WhenCreated : 19/10/2010 12:57:56 PM
WhenChangedUTC : 23/09/2015 4:15:18 AM
WhenCreatedUTC : 19/10/2010 2:57:56 AM
OrganizationId :
Id : corporate.MyDomain.com/Organisation/Meeting Rooms/MEETINGS - Executive Meeting Room
OriginatingServer : DCCORP01.corporate.MyDomain.com
ObjectState : Unchanged

I would check to see if Direct booking has been enabled on the one that isn't working. If you have both direct booking and Auto Accept enabled then this can cause issues, there is a script to detect and remove direct booking on http://blogs.technet.com/b/exchange/archive/2013/05/09/use-exchange-web-services-and-powershell-to-discover-and-remove-direct-booking-settings.aspx
Cheers
Glen

Related

Not able to perform Deep Insert operation for API_PRODUCT_SRV Standard WhiteListed API using S/4 Hana Cloud SDK

I have completed read and update operations on API_PRODUCT_SRV Service.
Now while doing deep insert on API_PRODUCT_SRV (Product Entity-which has many associations) I am getting the following error.
“errordetails”: [
{
“code”: “API_PRD_MSG/004”,
“message”: “Provide atleast one description for the product.”,
“propertyref”: “”,
“severity”: “error”,
“target”: “”
}
]
I found this deep dive blog
https://blogs.sap.com/2017/12/07/step-20-with-s4hana-cloud-sdk-create-and-deep-insert-with-the-virtual-data-model-for-odata/comment-page-1/#comment-453020
which explains the deep insert using servlets.(i.e Using HttpServletReq) which provides the rest service.
But I am using the CreateRequest class from SAP Cloud Application Programming Model which generates odata service, so that I cannot use the similar code which is presented in the blog.
I have added the code and the payload for your perusal.
Create Operation code
#Create(serviceName = "ProductService", entity = "Products")
public CreateResponse create(CreateRequest req) throws ODataException {
Product toCreate = new ModelMapper().map(req.getMapData(), Product.class);
Product created = new DefaultProductMasterService().createProduct(toCreate)
.execute(new ErpConfigContext("K4XS4SDKDest"));
return CreateResponse.setSuccess().setData(created).response();
}
Payload being used:
{
"Product" : "BALL",
"ProductType" : "ZHLB",
"CrossPlantStatus" : "",
"CrossPlantStatusValidityDate" : null,
"CreationDate" : "\/Date(1499731200000)\/",
"CreatedByUser" : "11279380",
"LastChangeDate" : "\/Date(1550448000000)\/",
"LastChangedByUser" : "HWV87616",
"IsMarkedForDeletion" : false,
"ProductOldID" : "",
"GrossWeight" : "0.000",
"PurchaseOrderQuantityUnit" : "",
"SourceOfSupply" : "",
"WeightUnit" : "KG",
"NetWeight" : "0.000",
"CountryOfOrigin" : "",
"CompetitorID" : "",
"ProductGroup" : "01",
"BaseUnit" : "EA",
"ItemCategoryGroup" : "",
"ProductHierarchy" : "",
"Division" : "",
"VarblPurOrdUnitIsActive" : "",
"VolumeUnit" : "",
"MaterialVolume" : "0.000",
"ANPCode" : "0",
"Brand" : "",
"ProcurementRule" : "",
"ValidityStartDate" : null,
"LowLevelCode" : "",
"ProdNoInGenProdInPrepackProd" : "",
"SerialIdentifierAssgmtProfile" : "",
"SizeOrDimensionText" : "",
"IndustryStandardName" : "",
"ProductStandardID" : "",
"InternationalArticleNumberCat" : "",
"ProductIsConfigurable" : false,
"IsBatchManagementRequired" : false,
"ExternalProductGroup" : "",
"CrossPlantConfigurableProduct" : "",
"SerialNoExplicitnessLevel" : "",
"ManufacturerPartProfile" : "",
"ChangeNumber" : "",
"MaterialRevisionLevel" : "",
"HandlingIndicator" : "",
"WarehouseProductGroup" : "",
"WarehouseStorageCondition" : "",
"StandardHandlingUnitType" : "",
"SerialNumberProfile" : "",
"AdjustmentProfile" : "",
"PreferredUnitOfMeasure" : "",
"IsPilferable" : false,
"IsRelevantForHzdsSubstances" : false,
"QuarantinePeriod" : "0",
"TimeUnitForQuarantinePeriod" : "",
"QualityInspectionGroup" : "",
"AuthorizationGroup" : "",
"HandlingUnitType" : "",
"HasVariableTareWeight" : false,
"MaximumPackagingLength" : "0.000",
"MaximumPackagingWidth" : "0.000",
"MaximumPackagingHeight" : "0.000",
"to_Description": {
"results": [
{
"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"
}
]
}
}
Can u please help me how shall I modify my code to make deep insert with SAP S/4HANA Cloud SDK work while using SAP Cloud Application Programming Model (CreateRequest class)?
Log file:
Product(super=VdmObject(customFields={}, changedOriginalFields={LowLevelCode=null, ProductGroup=null, SizeOrDimensionText=null, CreatedByUser=null, CountryOfOrigin=null, Product=null, ProductStandardID=null, IsPilferable=null, VolumeUnit=null, WarehouseProductGroup=null, WarehouseStorageCondition=null, MaterialVolume=null, ManufacturerPartProfile=null, CrossPlantStatus=null, TimeUnitForQuarantinePeriod=null, GrossWeight=null, InternationalArticleNumberCat=null, SourceOfSupply=null, ProductType=null, ItemCategoryGroup=null, ProcurementRule=null, BaseUnit=null, ProductOldID=null, VarblPurOrdUnitIsActive=null, LastChangedByUser=null, Brand=null, MaximumPackagingWidth=null, QuarantinePeriod=null, PurchaseOrderQuantityUnit=null, ProductHierarchy=null, AuthorizationGroup=null, StandardHandlingUnitType=null, MaterialRevisionLevel=null, ExternalProductGroup=null, CrossPlantConfigurableProduct=null, MaximumPackagingLength=null, HasVariableTareWeight=null, ANPCode=null, ProdNoInGenProdInPrepackProd=null, WeightUnit=null, IsMarkedForDeletion=null, CompetitorID=null, QualityInspectionGroup=null, IsBatchManagementRequired=null, IsRelevantForHzdsSubstances=null, Division=null, SerialIdentifierAssgmtProfile=null, AdjustmentProfile=null, PreferredUnitOfMeasure=null, SerialNoExplicitnessLevel=null, HandlingIndicator=null, HandlingUnitType=null, NetWeight=null, ProductIsConfigurable=null, IndustryStandardName=null, SerialNumberProfile=null, ChangeNumber=null, MaximumPackagingHeight=null}), product=BELL, productType=ZHLB, crossPlantStatus=, crossPlantStatusValidityDate=null, creationDate=null, createdByUser=11279380, lastChangeDate=null, lastChangedByUser=HWV87616, lastChangeDateTime=null, isMarkedForDeletion=false, productOldID=, grossWeight=0.000, purchaseOrderQuantityUnit=, sourceOfSupply=, weightUnit=KG, netWeight=0.000, countryOfOrigin=, competitorID=, productGroup=01, baseUnit=EA, itemCategoryGroup=, productHierarchy=, division=, varblPurOrdUnitIsActive=, volumeUnit=, materialVolume=0.000, aNPCode=0, brand=, procurementRule=, validityStartDate=null, lowLevelCode=, prodNoInGenProdInPrepackProd=, serialIdentifierAssgmtProfile=, sizeOrDimensionText=, industryStandardName=, productStandardID=, internationalArticleNumberCat=, productIsConfigurable=false, isBatchManagementRequired=false, externalProductGroup=, crossPlantConfigurableProduct=, serialNoExplicitnessLevel=, productManufacturerNumber=null, manufacturerNumber=null, manufacturerPartProfile=, changeNumber=, materialRevisionLevel=, handlingIndicator=, warehouseProductGroup=, warehouseStorageCondition=, standardHandlingUnitType=, serialNumberProfile=, adjustmentProfile=, preferredUnitOfMeasure=, isPilferable=false, isRelevantForHzdsSubstances=false, quarantinePeriod=0, timeUnitForQuarantinePeriod=, qualityInspectionGroup=, authorizationGroup=, handlingUnitType=, hasVariableTareWeight=false, maximumPackagingLength=0.000, maximumPackagingWidth=0.000, maximumPackagingHeight=0.000, erpConfigContext=null, toDescription=null, toPlant=null, toProductBasicText=null, toProductInspectionText=null, toProductProcurement=null, toProductPurchaseText=null, toProductQualityMgmt=null, toProductSales=null, toProductSalesTax=null, toProductStorage=null, toProductUnitsOfMeasure=null, toSalesDelivery=null)
{ "written_at":"2019-03-11T03:56:27.923Z","written_ts":918343802814688,"component_id":"e8c99eff-1a4e-4266-ba2a-fc099399100c","component_name":"FNpy7mXtvln0dnT1-FinalTestApp-srv","DCComponent":"","organization_name":"-","component_type":"application","space_name":"dev","component_instance":"0","organization_id":"-","correlation_id":"-","CSNComponent":"","space_id":"a78252bf-72bf-479c-b761-8260de0c776e","Application":"FNpy7mXtvln0dnT1-FinalTestApp-srv","container_id":"10.0.138.113","type":"log","logger":"com.sap.cloud.sdk.service.prov.api.util.ProcessorHelper","thread":"http-nio-0.0.0.0-3000-exec-7","level":"ERROR","categories":[],"msg":"The endpoint responded with HTTP error code 400.\nProvide atleast one description for the product.\nFull error message: \n{\n \"error\": {\n \"code\": \"API_PRD_MSG/004\",\n \"message\": {\n \"lang\": \"en\",\n \"value\": \"Provide atleast one description for the product.\"\n },\n \"innererror\": {\n \"application\": {\n \"component_id\": \"LO-MD-MM\",\n \"service_namespace\": \"/SAP/\",\n \"service_id\": \"API_PRODUCT_SRV\",\n \"service_version\": \"0001\"\n },\n \"transactionid\": \"C16DD240C7520010E005C7E648BC12F5\",\n \"timestamp\": \"20190311035627.5989630\",\n \"Error_Resolution\": {\n \"SAP_Transaction\": \"For backend administrators: run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details\",\n \"SAP_Note\": \"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)\"\n },\n \"errordetails\": [\n {\n \"code\": \"API_PRD_MSG/004\",\n \"message\": \"Provide atleast one description for the product.\",\n \"propertyref\": \"\",\n \"severity\": \"error\",\n \"target\": \"\"\n }\n ]\n }\n }\n}","stacktrace":["java.lang.reflect.InvocationTargetException","\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)","\tat
my-service.cds
using API_PRODUCT_SRV from '../srv/external/csn/API_PRODUCT_SRV.json';
service ProductService {
entity Products as Projection on API_PRODUCT_SRV.A_ProductType {
key Product,
ProductType,
CreationDate,
CrossPlantStatus,
CrossPlantStatusValidityDate,
CreatedByUser,
LastChangeDate,
LastChangedByUser,
IsMarkedForDeletion,
ProductOldID,
GrossWeight,
PurchaseOrderQuantityUnit,
SourceOfSupply,
WeightUnit,
NetWeight,
CountryOfOrigin,
CompetitorID,
ProductGroup,
BaseUnit,
ItemCategoryGroup,
ProductHierarchy,
Division,
VarblPurOrdUnitIsActive,
VolumeUnit,
MaterialVolume,
ANPCode,
Brand,
ProcurementRule,
ValidityStartDate,
LowLevelCode,
ProdNoInGenProdInPrepackProd,
SerialIdentifierAssgmtProfile,
SizeOrDimensionText,
IndustryStandardName,
ProductStandardID,
InternationalArticleNumberCat,
ProductIsConfigurable,
IsBatchManagementRequired,
ExternalProductGroup,
CrossPlantConfigurableProduct,
SerialNoExplicitnessLevel,
ProductManufacturerNumber,
ManufacturerPartProfile,
ChangeNumber,
MaterialRevisionLevel,
HandlingIndicator,
WarehouseProductGroup,
WarehouseStorageCondition,
StandardHandlingUnitType,
SerialNumberProfile,
AdjustmentProfile,
PreferredUnitOfMeasure,
IsPilferable,
IsRelevantForHzdsSubstances,
QuarantinePeriod,
TimeUnitForQuarantinePeriod,
QualityInspectionGroup,
AuthorizationGroup,
HandlingUnitType,
HasVariableTareWeight,
MaximumPackagingLength,
MaximumPackagingWidth,
MaximumPackagingHeight,
to_Description
}
entity A_ProductDescriptionType as Projection on API_PRODUCT_SRV.A_ProductDescriptionType
{
key Product,
key Language,
ProductDescription
}
}
Can u please tell how to add associations in it?
my-service.cds
using API_BUSINESS_PARTNER as bp from './external/csn/API_BUSINESS_PARTNER';
service CrudService{
#cds.persistence.skip
Entity BusinessPartner as projection on bp.A_BusinessPartnerType{
BusinessPartner,
LastName,
FirstName,
BusinessPartnerCategory
};
}
Warm regards,
Meenakshi
Can you please share your entire project if possible. The request map may not be containing the product description data because I guess the association between the product and description is not defined properly in the CDS file.
Please check the following documentation to define your entities and associations:
https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/855e00bd559742a3b8276fbed4af1008.html
I am interested in knowing what is the $metadata response for your service currently. Also, I would like to see your custom handler code and how you are trying to retrieve the deep insert payload from the request object.
Thanks,
Kranti
The problem is your JSON request payload:
{
"Product" : "BALL",
...
"to_Description": {
"results": [
{
"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"
}
]
}
}
to_Description is not expected to be an object. Instead it should be an array:
{
"Product" : "BALL",
...
"to_Description": [
{
"Product" : "BALL",
"Language" : "EN",
"ProductDescription" : "Pipes for machines"
}
]
}

I want to writing a queires in python script which is ultimately going to call these queries from django

Here is my mongodb database :
**{"Fruit" : "Pomegranate", "District" : "Nasik", "Taluka" : "Nasik", "Revenue circle" : "Nasik", "Sum Insured" : 28000, "Area" : 1200, "Farmer" : 183 }
{"Fruit" : "Pomegranate", "District" : "Jalna", "Taluka" : "Jalna", "Revenue circle" : "Jalna", "Sum Insured" : 28000, "Area" : 120, "Farmer" : 13 }
{"Fruit" : "Guava", "District" : "Pune", "Taluka" : "Haveli", "Revenue circle" : "Uralikanchan", "Sum Insured" : 50000, "Area" : 10, "Farmer" : 100 }
{"Fruit" : "Guava", "District" : "Nasik", "Taluka" : "Girnare", "Revenue circle" : "Girnare", "Sum Insured" : 50000, "Area" : 75, "Farmer" : 90 }
{"Fruit" : "Banana", "District" : "Nanded", "Taluka" : "Nandurbar", "Revenue circle" : "NandedBK", "Sum Insured" : 5000, "Area" : 2260, "Farmer" : 342 }
{"Fruit" : "Banana", "District" : "Jalgaon", "Taluka" : "Bhadgaon", "Revenue circle" : "Bhadgaon", "Sum Insured" : 5000, "Area" : 220, "Farmer" : 265 }**
Here is my models.py file :
from mongoengine import Document, fields
from django.db.models import Q
class Tool(Document):
Fruit = fields.StringField(required=True)
District = fields.StringField(required=True)
Taluka = fields.StringField(required=True)
Revenue_circle = fields.StringField(required=True)
Sum_Insured = fields.StringField(required=True)
Area = fields.StringField(required=True)
Farmer = fields.StringField(required=True)
Here is my serializers.py file :
from rest_framework import serializers
from rest_framework_mongoengine.serializers import DocumentSerializer
from models import Tool
class ToolSerializer(DocumentSerializer):
#id = serializers.CharField(read_only=False)
class Meta:
model = Tool
#fields=['Fruit']
Here is my views.py file
from __future__ import unicode_literals
from django.template.response import TemplateResponse
from rest_framework_mongoengine.viewsets import ModelViewSet as MongoModelViewSet
from app.serializers import *
def index_view(request):
context = {}
return TemplateResponse(request, 'index.html', context)
class ToolViewSet(MongoModelViewSet):
lookup_field = 'Fruit'
serializer_class = ToolSerializer
def get_queryset(self):
return Tool.objects.all()
Now, I want to writing queires,
But when I use lookup filed='Fruit' in views.py file then
http://127.0.0.1:8000/api/tool/Banana/
I get All information for fruit which is banana .
127.0.0.1:8000/api/tool/Guava/
then I get All information for fruit which is guava.
lookup filed is use for single fields,
But,I want to write all types of combination queires.
for example:
/api/tool/Guava/ (gives all data for fruit is guava)
/api/tool/Nasik/ (gives all data for district is Nasik)
/api/tool/Uralikanchan/ (gives all data for revenue_circle is uralikanchan)
/api/tool/265 (gives all data for farmer is 265)
/api/tool/2260/ (gives all data for Area is 2260 )
So,can you please tell me how to write all types of combination queries which call these queires to django?
you can use rest-framework-filter-backend ,create Filterset
see this doc http://www.django-rest-framework.org/api-guide/filtering/
You need to override the view's get_queryset to perform the request you want on the fields you want.

How to add HATEOAS links in a sub resource

I have a parent resource called the AdminResource and a child resource called the AdminModuleResource.
The resource of the parent is correctly fitted with HATEOAS links:
{
"firstname" : "Stephane",
"lastname" : "Eybert",
"email" : "mittiprovence#yahoo.se",
"password" : "e41de4c55873f9c000f4cdaac6efd3aa",
"passwordSalt" : "7bc7bf5f94fef7c7106afe5c3a40a2",
"links" : [ {
"rel" : "self",
"href" : "http://localhost/admins/3683"
}, {
"rel" : "modules",
"href" : "http://localhost/admins/3683/modules"
} ],
"id" : 3683
}
The resource of the child is also correctly fitted with HATEOAS links:
{
"module" : "BTS",
"adminResource" : {
"firstname" : "Stephane",
"lastname" : "Eybert",
"email" : "mittiprovence#yahoo.se",
"password" : "e41de4c55873f9c000f4cdaac6efd3aa",
"passwordSalt" : "7bc7bf5f94fef7c7106afe5c3a40a2",
"links" : [ ],
"id" : 3683
},
"links" : [ {
"rel" : "self",
"href" : "http://localhost/modules"
} ],
"id" : 1087
}
But its parent resource has lost its links.
For now, when inside my child admin module resource, the parent admin resource does not have its links. Indeed the toResource method of the assembler only provides the links for the child admin module resource.
public AdminModuleResource toResource(AdminModule adminModule) {
AdminModuleResource adminModuleResource = new AdminModuleResource();
adminModuleResource.fromAdminModule(adminModule);
adminModuleResource.add(linkTo(AdminModuleController.class).slash(adminModuleResource.getId()).withSelfRel());
return adminModuleResource;
}
public AdminResource toResource(Admin admin) {
AdminResource adminResource = createResourceWithId(admin.getId(), admin);
adminResource.fromAdmin(admin);
adminResource.add(linkTo(AdminController.class).slash(admin.getId()).slash(UriMappingConstants.MODULES).withRel(UriMappingConstants.MODULES));
return adminResource;
}
Any idea how I can add the links to the parent admin resource even when inside the child admin module resource ?
EDIT: Here is how I build the resources:
public void fromAdminModule(AdminModule adminModule) {
this.setResourceId(adminModule.getId());
this.setModule(adminModule.getModule());
AdminResource adminResource = new AdminResource();
adminResource.fromAdmin(adminModule.getAdmin());
this.adminResource = adminResource;
}
public void fromAdmin(Admin admin) {
this.setResourceId(admin.getId());
this.setFirstname(admin.getFirstname());
this.setLastname(admin.getLastname());
this.setEmail(admin.getEmail().toString());
this.setPassword(admin.getPassword());
}
Thanks !
Stephane
Just stumbled on this question, even though it is quite old, but may be worth answering for others implementing similar functionality. Basically, you create embedded resources for AdminModuleResource on your AdminResource and build the links for these embedded resources within your AdminResourceAssembler. The code below is a simplified version of what is posted on this answer
On AdminResource add:
#JsonUnwrapped
private Resources<EmbeddedWrapper> embeddeds;
// + setters/getters
On AdminResourceAssembler add:
EmbeddedWrappers wrapper = new EmbeddedWrappers(true);
List<EmbeddedWrapper> wrappers = (List<EmbeddedWrapper>) super.buildEmbeddables(entity);
Set<AdminModuleResource> moduleResources = adminResource.getModuleResources( );
if(!moduleResources.isEmpty( ))
wrappers.add(wrapper.wrap(adminModuleResourceAssembler.toResources(moduleResources)));
adminResource.setEmbeddeds(new Resources<>(wrappers));

update in a nested array using C# Driver in MongoDB

Here is my exact schema:
{
"_id" : ObjectId("4fb4fd04b748611ca8da0d45"),
"Name" : "Agent name",
"City" : "XXXX",
"BranchOffice" : [{
"_id" : ObjectId("4fb4fd04b748611ca8da0d46"),
"Name" : "Branch name",
"City" : "XXXX",
"SubBranch" : [{
"_id" : ObjectId("4fb4fd04b748611ca8da0d47"),
"Name" : "Sub-Branch Name",
"City" : "XXXX"
"Users" : [{
"_id" : ObjectId("4fb4fd04b748611ca8da0d48"),
"Name" : "User",
"City" : "XXXX"
}]
}]
}]
}
Its Inserted successfully in c#. insert code was below but update condition is failed .
I want to update field 3 level and 4 level of array using SubBranch and users
Insert code
IMongoQuery query = Query.And(Query.EQ("_id", new ObjectId(4fb4fd04b748611ca8da0d45)),
Query.EQ("BranchOffice._id", new ObjectId(4fb4fd04b748611ca8da0d46)));
Agent agent = dc.Collection.FindOne(query);
BsonDocument branchOffice = agent.BranchOffice.Find(objId => objId._id == new ObjectId(4fb4fd04b748611ca8da0d46)).ToBsonDocument();
subBranch I had get List object convert to BsonDocument
Files: name,city,_Id, and users for array
BsonDocument subBranchOffice = **subBranch.ToBsonDocument()**;
if (branchOffice.Contains("SubBranch"))
{
if (branchOffice["SubBranch"].IsBsonNull)
{
branchOffice["SubBranch"] = new BsonArray().Add(BsonValue.Create(subBranchOffice));
}
else
{
branchOffice["SubBranch"].AsBsonArray.Add(BsonValue.Create(subBranchOffice));
}
var update = Update.Set("BranchOffice.$.SubBranch",branchOffice["SubBranch"]);
SafeModeResult s = dc.Collection.Update(query, update, UpdateFlags.Upsert,SafeMode.True);
}
Here SafemodeResult is UpdateExisting = true
Here Inserted Option is successfully
next I try to update in else Statement. I am not get it answer
Update code
else
{
var queryEdit = Query.And(Query.EQ("_id", new ObjectId(4fb4fd04b748611ca8da0d45)),
Query.EQ("BranchOffice._id", new ObjectId(4fb4fd04b748611ca8da0d46)),
Query.EQ("SubBranchlist._id", new ObjectId(4fb4fd04b748611ca8da0d47)));
**//Index value 1 or 2 or 3**
var update = Update.Set("BranchOffice.$.SubBranch."index value".Name", "sname").
Set("BranchOffice.$.SubBranch."index value".city", "yyyyy" ?? string.Empty);
SafeModeResult s = dc.Collection.Update(queryEdit, update, UpdateFlags.None,SafeMode.True);
}
Here SafemodeResult is UpdateExisting = False
Here updated Option is fail
Please explain how to solve this probelm and how to update field 2 and 3 level of array
Please show any Example
There's a lot there, but it looks like at least part of your problem is that you've spelled BranchOffice differently between the data and the query you are using to update, also you've missed the hierarchy in SubBranch, so your queryEdit in the last code sample won't match the document. This will;
db.so.find({
_id: ObjectId("4fb4fd04b748611ca8da0d45"),
"BrancheOffice._id": ObjectId("4fb4fd04b748611ca8da0d46"),
"BrancheOffice.SubBranch._id": ObjectId("4fb4fd04b748611ca8da0d47"),
}).toArray()

Ruby Mongo::ObjectID comparison

SO,
I have two Mongo::ObjectID objects that are equal according to both == and eql? (they both return true). However, if one is a key in a Hash and the other is in a document stored in an array, this fails:
myhash[array_of_docs[0]['_id']] # => nil
myhash.fetch(array_of_docs[0]['_id']) # => KeyError: key not found
My db has 2 collections, "bookmarks", with mainly a title and url, and "tags", with a 'bkm_id' key pointing to a bookmark doc's _id and a 'name' key. With the following query, I map each bookmark's _id to the corresponding comma-separated list of tags:
bkms_tags_array = tags_collection.group(['bkm_id'], nil, { tags: Array.new }, "function(tag, agg){ agg.tags.push(tag.name) }", true)
bkms_tags = {}
bkms_tags_array.each do |bt|
bkms_tags.merge! Hash[bt.values[0], bt.values[1].join(", ")]
end
bkms_tags # => {4d60b29603e5665f82000001=>"socialnw, blablabla", 4d60b44703e5665fff000001=>"mail, app, google", 4d61812f03e5661ad8000001=>"socialnw, comms, web"}
Given that bks is the result of 'bookmarks_collection.find.to_a', this is my problem:
bkms_tags[bks[0]['_id']] # => nil
bkms_tags.include? bks[0]['_id'] # => false ; however:
bkms_tags.keys.include? bks[0]['_id'] # => true
How come 'hash.include?' be false and 'hash.keys.include?' be true? Is there a difference between ObjectIDs returned by different queries?
Like I said, both == and eql? return true:
bkms_tags.each { |k,v| puts k == bks[0]['_id'] } # => true false false
bkms_tags.keys.each { |k| puts k == bks[0]['_id'] } # => true false false
bkms_tags.each { |k,v| puts k.eql? bks[0]['_id'] } # => true false false
bkms_tags.keys.each { |k| puts k.eql? bks[0]['_id'] } # => true false false
So, by any comparison possible, 'bks[0]['_id']' is a key of bkms_tags, but when I try to retrieve it's value, Ruby gets confused somehow.
Any ideas? Thanks!
Extra info:
Some sample documents:
Bookmarks
{ "_id" : ObjectId("4d60b29603e5665f82000001"), "url" : "http://www.facebook.com/", "title" : "Facebook", "host" : "facebook.com", "saved_at" : "Sun Feb 20 2011 01:20:06 GMT-0500 (PET)" }
{ "_id" : ObjectId("4d60b44703e5665fff000001"), "url" : "http://mail.google.com/", "title" : "gmail", "host" : "mail.google.com", "saved_at" : "Sun Feb 20 2011 01:27:19 GMT-0500 (PET)" }
{ "_id" : ObjectId("4d61812f03e5661ad8000001"), "url" : "http://twitter.com/", "title" : "twitter", "host" : "twitter.com", "saved_at" : "Sun Feb 20 2011 16:01:35 GMT-0500 (PET)" }
Tags
{ "_id" : ObjectId("4d60b44703e5665fff000002"), "bkm_id" : ObjectId("4d60b44703e5665fff000001"), "name" : "mail" }
{ "_id" : ObjectId("4d60b44703e5665fff000003"), "bkm_id" : ObjectId("4d60b44703e5665fff000001"), "name" : "app" }
{ "_id" : ObjectId("4d60b29603e5665f82000003"), "bkm_id" : ObjectId("4d60b29603e5665f82000001"), "name" : "socialnw" }
{ "_id" : ObjectId("4d60b29603e5665f82000004"), "bkm_id" : ObjectId("4d60b29603e5665f82000001"), "name" : "blablabla" }
{ "_id" : ObjectId("4d61812f03e5661ad8000003"), "bkm_id" : ObjectId("4d61812f03e5661ad8000001"), "name" : "comms" }
{ "_id" : ObjectId("4d61812f03e5661ad8000004"), "bkm_id" : ObjectId("4d61812f03e5661ad8000001"), "name" : "web" }
EDIT
Testing some more, I came up with more irregularities:
bkms_ids # => [4d60b29603e5665f82000001, 4d61812f03e5661ad8000001, 4d61ba9103e5667dbe000001, 4d61ba9103e5667dbe000001]
bkms_ids[2] == bkms_ids[3] # => true
bkms_ids[2].eql? bkms_ids[3] # => true
bkms_ids.uniq # => nothing changes: [4d60b29603e5665f82000001, 4d61812f03e5661ad8000001, 4d61ba9103e5667dbe000001, 4d61ba9103e5667dbe000001]
EDIT 2
As requested, my bson version:
irb> BSON::VERSION # NameError: uninitialized constant BSON::VERSION
$ gem list bson
*** LOCAL GEMS ***
bson (1.2.2)
bson_ext (1.2.2)
and inspect and class of my array of docs:
array_of_docs = bookmarks_collection.find.to_a
array_of_docs[0].inspect # => "{\"_id\"=>4d60b29603e5665f82000001, \"url\"=>\"http://www.facebook.com/\", \"title\"=>\"Facebook\", \"host\"=>\"facebook.com\", \"saved_at\"=>2011-02-20 06:20:06 UTC}"
array_of_docs[0].class # => OrderedHash
array_of_docs[0]['_id'].class # => Mongo::ObjectID
Change uniq to uniq! :
bkms_ids
bkms_ids[2] == bkms_ids[3]
bkms_ids[2].eql? bkms_ids[3]
bkms_ids.uniq!

Resources