cancel
Showing results for 
Search instead for 
Did you mean: 

BusinessAttributes Item are not creatable via script

JOSC_ITLAB
Participant
0 Kudos
209

Hello,

i just recently created a post related to that topc but deleted it since i got some more infos.

Generally speaking; The creation of items in the BusinessAttributes (either attached to a bo or not) is not working.

var bpBA : elementsof BusinessAttributeAssignment;
var bpBAi : elementsof BusinessAttributeAssignment.Item;

var query = BusinessAttributeSet.QueryByElements;
var result = query.Execute();

bpBA.AssignedObjectUUID = bp.UUID.content; // BusinessPartnerUUID
bpBA.ObjectTypeCode.content = "1407";

var bpBAn = BusinessAttributeAssignment.Create(bpBA);          
var x = BusinessAttributeAssignment.Retrieve(bp.UUID.content);  


// In Runtime x is getting filled (just wanted to be sure that the coding works)       

foreach( var group in result)
{
  if(group.BusinessAttributeKey.BusinessAttributeSetID == "DE_NEWS")
  {
    bpBAi.BusinessAttributeID = "NEWS";
    bpBAi.AttributeValue.content = "111";
    bpBAi.BusinessAttributeSetKey.BusinessAttributeSetID = group.BusinessAttributeKey.BusinessAttributeSetID;
    bpBAi.BusinessAttributeSetKey.ObjectTypeCode.content = group.BusinessAttributeKey.ObjectTypeCode.content;

    var k = BusinessAttributeSet.Retrieve(bpBAi.BusinessAttributeSetKey);
    // k also
gets filled with the right data

    bpBAi.BusinessAttributeSetKey = k.BusinessAttributeKey;

   var t = x.Item.Create(bpBAi);


   // Here in the runtime the data gets filled accoardingly besides the AttributeSetUUID. It also creates the error, that the BusinessAttributeSetID is not valid.
  }
}

What also doesnt work:

bp.MarketingAttributes.Item.Create(bpBAi);

The error is always the same: Groupname not valid.

But Receiving the BusinessAttributeSet via the exact same data works.

Here is the corresponding Marketinggroup structure in the system:

-

-

I debugged the data of a BusinessPartner with marketing attributes created on the UI and i see no difference in the data at all, besides the missing AttributeSetUUID which is readonly and i think would be set if the item creation were able to receive the attribute set.

If you have any idea on how to set up the data or the correct answer for this issue please provide it for me and other users.

Kind Regards,

Johannes

Accepted Solutions (0)

Answers (0)