eWam AppendObject fails to append object to the list - web-services

I'm running a census load through web services to create a member contract including voluntary spouse coverage. The employee and employee coverage are created succesfully, but when the spouse person object is being created, the correspondence fails to get appended to the correspondence list.
eWam 6.0.0.36 wInterface 4.1.24.0
Method: CreateListOfActorCorrespondences
forEach curActorCorrespondence in ListOfCreatedCorrespondences using rank
**thisActor.Correspondences.AppendObject(curActorCorrespondence)**
if rank = DefaultCorrespondenceRank
curActorCorrespondence.SetAsDefault
endIf
endFor
The same method is called to create the employee, but when creating the spouse the curActorCorrespondence which is successfully created isn't appended to thisActor.Correspondences. What could be causing the difference in behavior in this code?

Look for errors
Start by searching the WSM error trace.
In this case the following error was found:
14/01/16 15:48:12 Process Id 4176 Thread Id 6440 Thread
Index 1 Minor error WLISTOF.CPP
aListReftosType.ListInsert is refused by the role:
aWFCorrespondenceVersionedByDate Add =0000:0000:2380:2F00 NSId = 0 Id
= 0 Version = 2147483647 Current Gold method:SLI_Actor._CreateListOfActorCorrespondences #3
The issue is then clear, as aXXX_CorrespondenceVersionedByDate child class of aWFCorrespondenceVersionedByDate existed, but was not being created for the spouse. Further review of the class structure showed the class aSPLI_CreateOrUpdatePerson_In didn’t have any children classes so it couldn’t be a missing overriding/ child class causing the incorrect object to be created.
Make sure the XML nodes are representative of the class structure
Debug fillvarfromparam and Deserialize methods in classes generated by wInterface to finally find the issue with inconsistencies in the XML structure.
In this case:
Under employee tag:
<Correspondences xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:aXXX_Correspondance">
Under enrollment tag(where the failure was happening):
<Correspondences xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:aXXX_Correspondance">
<Element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Correct or Realign the XML
Moving the xsi:type attribute to the correct tag fixed the issue, allowing the correct correspondence list to be created and appended.

Related

Acumatica - Creating Custom Usr Field on Purchase Orders for Weight Total

I am trying to add a new field through the customization browser to the Purchase Orders screen (PO301000). I created the field through the New Field button and edited the Data Access slightly to provide a default parameter for the field. Here is the code in the Data Access:
[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName="Weight Total")]
This field will be used to calculate the total weight of the purchase order and I would like it to be stored in the database.
I get this error when publishing:
An error while publishing the database item POOrder
with the message:
Nullable object must have a value.
I have tried changing the PXDBDecimal to a PXDBQuantity. This has to be done through the customization browser and not the database itself because this project will be going on a SaaS hosted site where I do not have access to the database. I have also tried creating the field through the DAC only and I receive this error when trying to open the page:
Invalid column name 'UsrWeightTotal'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'UsrWeightTotal'.
When reviewing the project xml for the POOrder table entry in the customization I found there were some extra/missing attributes required for a column type of decimal.
There was a MaxLength property and no DecimalLength property. I compared it to adding a new field of type decimal and looked at the project xml to come up with the following:
<Table TableName="POOrder">
<Column TableName="POOrder" ColumnName="UsrWeightTotal" ColumnType="decimal" AllowNull="True" DecimalPrecision="6" DecimalLength="19" IsNewColumn="True" IsUnicode="True" />
</Table>
I bet the error was complaining about the missing DecimalLength value (as a result was null but required for the publish process).

XML submitted just fine to Amazon MWS but price not being updated

I created my own repricer of sorts but the price isn't being updated on Amazon's side.
My code seems to work just fine based off the response from Amazon after submitting it. I'm hoping someone here knows more about why its not actually updating the price.
Here's the XML submitted:
<?xml version="1.0" encoding="utf-8" ?>
<AmazonEnvelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>MERCHANTID</MerchantIdentifier>
</Header>
<MessageType>Price</MessageType>
<Message>
<MessageID>1</MessageID>
<Price>
<SKU>mysku</SKU>
<StandardPrice currency="USD">350.50</StandardPrice>
</Price>
</Message>
</AmazonEnvelope>
Heres the response:
GetFeedSubmissionResultResponse{}(ResponseMetadata: <Element_?/ResponseMetadata_0x7fee61f74248>, GetFeedSubmissionResultResult: <Element_?/GetFeedSubmissionResultResult_0x7fee61f74248>, AmazonEnvelope:
{'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation': 'amzn-envelope.xsd'}, DocumentVersion: '1.02', MerchantIdentifier: 'M_EXAMPLE_1234', Header: '\n\t', MessageType: 'ProcessingReport', MessageID: '1', DocumentTransactionID: '4200000000', StatusCode: 'Complete', MessagesProcessed: '1', MessagesSuccessful: '1', MessagesWithError: '0', MessagesWithWarning: '0', ProcessingSummary: '\n\t\t\t', ProcessingReport: '\n\t\t', Message: '\n\t')
I don't know if showing my code will help in this instance since I get a successful response from Amazon. Here it is regardless:
...
# Provide credentials.
conn = MWSConnection(
aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
Merchant=AMZ_SELLER_ID
)
# Get the service resource
sqs = boto3.resource('sqs')
# Get the queue
queue = sqs.get_queue_by_name(QueueName=SQS_QUEUE_NAME)
for index, message in enumerate(queue.receive_messages(MaxNumberOfMessages=10)):
...
import time
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('repricer', 'xml_templates'), trim_blocks=True, lstrip_blocks=True)
template = env.get_template('_POST_PRODUCT_PRICING_DATA_.xml')
class Message(object):
def __init__(self, s, price):
self.SKU = s
self.PRICE = round(price, 2)
self.CURRENCY = USD_CURRENCY
feed_messages = [
Message(sku.sku, new_price),
]
namespace = dict(MerchantId=AMZ_SELLER_ID, FeedMessages=feed_messages)
feed_content = template.render(namespace).encode('utf-8')
print(feed_content)
feed = conn.submit_feed(
FeedType='_POST_PRODUCT_PRICING_DATA_',
PurgeAndReplace=False,
MarketplaceIdList=[MARKETPLACE_ID],
content_type='text/xml',
FeedContent=feed_content
)
feed_info = feed.SubmitFeedResult.FeedSubmissionInfo
print('Submitted product feed: ' + str(feed_info))
while True:
submission_list = conn.get_feed_submission_list(
FeedSubmissionIdList=[feed_info.FeedSubmissionId]
)
info = submission_list.GetFeedSubmissionListResult.FeedSubmissionInfo[0]
submission_id = info.FeedSubmissionId
status = info.FeedProcessingStatus
print('Submission Id: {}. Current status: {}'.format(submission_id, status))
if status in ('_SUBMITTED_', '_IN_PROGRESS_', '_UNCONFIRMED_'):
print('Sleeping and check again....')
time.sleep(60)
elif status == '_DONE_':
feedResult = conn.get_feed_submission_result(FeedSubmissionId=submission_id)
print(feedResult)
break
else:
print("Submission processing error. Quit.")
break
There are a couple of possible reasons, listed roughly in the order of likelihood:
1. Amazon is slower to update values than they say they are. It is possible that although the feed was successful, there is still a period of time before that change reflects on Amazon (even changing values from SellerCentral comes with a messages that it isn't instant).
Wait a few minutes and see if the change eventually shows up.
2. You could have an alternate repricing service still active. If you are currently using another repricer for this SKU, it might be competing with your attempts and reverting the price based on its own ruleset.
It's possible to use the GetFeedSubmissionList call to see if another _POST_PRODUCT_PRICING_DATA_ feed was submitted after yours (though with no way to view the submitted contents).
3. There might be a conflict with the min and max prices on the SKU (whether you set them or not), and the price you tried to set is outside of the allowed range. This is a result of one of Amazon's policies requiring new and updated SKU's to have those set or it uses a default criteria.
In our continued effort to reduce price error risks to sellers and to avoid potentially negative customer experiences, starting on January 14, 2015, you will not be able to use your Seller Central preferences to select a blanket “opt-out” from all potential low- and high-pricing error rules. Instead, you will need to set a minimum and maximum allowed selling price for each product in your inventory if you do not want Amazon’s default potential pricing error rules to apply to that product.
I can't find an announcement page on this so it may have been an email, but it is quoted as such on the forums
Under those circumstances the feed will report back successful (because its references/format are correct), but the price change will silently fail because of the price range limits that are set.
You can verify if this is your issue by viewing the SKU under SellerCentral Manage Inventory page. You may have to turn on the min/max columns to view current values depending on your preferences set for that page.
Unfortunately, there is no way to pull min/max prices on inventory items to know if this will be an issue ahead of time:
Dear Seller,
I am Sharon from Amazon Seller Support and I will be assisting you with your concern today.
From the content of your email, I understand that you are concerned if there's any report where you can download the report for 'Minimum Price' and 'Maximum Price'.
I regret to inform you that as of now the reports which are available will only provide information for 'standard_price' and 'list_price'.
I understand that this is a disappointment for you but please understand that as of not this feature of including 'Minimum Price' and 'Maximum Price' in the inventory reports has not been included and I sincerely apologize for all the inconvenience caused to you in this regard.
via support ticket to Amazon MWS team, Jul 03, 2016
4. It could be possible Amazon does not allow the feed to update a price during an active promotion. You should be able to check if an item is on sale by viewing the SellerCentral Manage Inventory page, where the "price" column would be bordered in green.
Seems unlikely as they require the "StandardPrice" element to be provided with the "Sale" element, but Amazon's own "Automate Pricing" tool lists it as a possible reason for the tool failing.
5. You are applying the price update to the wrong marketplace.
If the id provided to the call under MarketplaceIdList=[MARKETPLACE_ID], is for a different marketplace than the one you are checking, you won't see the price change.
Amazon does fail the feed submission request if you submit to a marketplace you do not have access to, so this may not be the issue if you only have one marketplace.
6. You are looking for the new price in the wrong spot.
If you are looking under the SellerCentral Manage Inventory page, make sure you are looking at the "Price" column and not the "Lowest Price" column.
If you are looking at the product's detail or offer page (on Amazon's storefront), make sure you are looking at your offer. You may not be the main offer shown on the detail page or the top offer shown on the offer listing page.
And of course, make sure you have the right SKU / ASIN.
7. This is for a different feed, but a user has reported that Amazon just doesn't update information sometimes, requiring the feed to be resent.
There is an alternate feed you can try using to update price information _POST_FLAT_FILE_INVLOADER_DATA_, but it is a flat file type (tab delimited) so your XML schema would not transfer over. Probably only worth trying if you think the issue is related to the specific feed you're using.
I don't know Python but your XML looks ok, here is my PHP code which I use to do price change for last 5 years and it works fine. I don't know if this helps you as it's PHP.
$feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>$merchant_token</MerchantIdentifier>
</Header>
<MessageType>Price</MessageType>
<Message>
<MessageID>1</MessageID>
<Price>
<SKU>$sku</SKU>
<StandardPrice currency="$currency">$new_price</StandardPrice>
</Price>
</Message>
</AmazonEnvelope>
EOD;
$feed = trim($feed);
$feedHandle = #fopen('php://temp', 'rw+');
fwrite($feedHandle, $feed);
rewind($feedHandle);
$parameters = array(
'Merchant' => $MERCHANT_ID,
'MarketplaceIdList' => $marketplaceIdArray,
'FeedType' => '_POST_PRODUCT_PRICING_DATA_',
'FeedContent' => $feedHandle,
'PurgeAndReplace' => false, //Leave this PurgeAndReplace to false so that it want replace whole product in amazon inventory
'ContentMd5' => base64_encode(md5(stream_get_contents($feedHandle), true))
);
rewind($feedHandle);
$request = new MarketplaceWebService_Model_SubmitFeedRequest($parameters);
$return_feed = invokeSubmitFeed($service, $request, $price_change_info_log);
fclose($feedHandle);
I ended up contacting Amazon api support and they found out that it takes up to 15 minutes for the price to change. Also I had another script that uploaded new products and updated the inventory & price for existing products...this script was competing with my repricing script.
I resolved the issue by changing how the second script updates price for existing products.

Netsuite webservices get order/invoice request, items type is blank

Does anyone know how to get the type of an item that is on an order or invoice via a getRequest?
When I get the list of items via the getRequest (webservices) from the order or invoice, the type fields in the items are empty.
So I can't then do a new getRequest to get the item because I don't know the item type.
This then makes to many requests as I will need to do a search for the item ID first to find the item type to get the actual item.
EDITED
This is my getRequest:
$service = new APDIBLE\NetSuite\NetSuiteService($netsuite_config);
$request = new APDIBLE\NetSuite\Classes\GetRequest();
$request->baseRef = new APDIBLE\NetSuite\Classes\RecordRef();
$request->baseRef->internalId = $internalid;
$request->baseRef->type = 'salesOrder';
$getResponse = $service->get($request);
And that works fine, i get the salesOrder without error. It is just all the RecordRef fields including the items in the itemlist have an empty type field. I have noticed this is with every getRequest that i do for anything, they type field is always empty.
this is my XML Request if it helps:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:core_2015_1.platform.webservices.netsuite.com" xmlns:ns2="urn:messages_2015_1.platform.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="ns">
<SOAP-ENV:Header>
<ns3:applicationInfo xsi:type="ns2:ApplicationInfo">
<ns2:applicationId>************************************</ns2:applicationId>
</ns3:applicationInfo>
<ns3:passport xsi:type="ns1:Passport">
<ns1:email>**********</ns1:email>
<ns1:password>***********</ns1:password>
<ns1:account>***********</ns1:account>
<ns1:role internalId="**********"/>
</ns3:passport>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns2:get>
<ns2:baseRef xsi:type="ns1:RecordRef" type="salesOrder" internalId="4153"/>
</ns2:get>
</SOAP-ENV:Body>
and this is the returned item value of one of the list items:
<tranSales:item internalId="2451" xmlns:platformCore="urn:core_2015_1.platform.webservices.netsuite.com">
<platformCore:name>test non-inventory item</platformCore:name>
</tranSales:item>
You can see the item ID and name is there but no type is returned. and this is the same for all RecordRef fields.
This is standard NetSuite behavior.
In nearly all cases where items are referenced the type is not defined alongside the record reference. There's not a way to change this behavior in the API. Searching for the item type is one way to pull the type so you can get the item from the NetSuite API.
You could also just attempt to get the item with a list of the most popular item types. This is often faster since a NetSuite get call to an invalid record reference is very quick to execute, often orders-of-magnitude faster than a search.
Here's an example implementation:
https://github.com/NetSweet/netsuite/blob/659d4634e8ab2ae26d8a860ecb5fc47a803da7c7/lib/netsuite/utilities.rb#L164

unable to create an issue in jira using testlink

Create JIRA Ticket FAILURE => com.atlassian.jira.rpc.exception.RemoteValidationException: {customfield_10000=Component is required.} : [] - serialized issue:a:5:{s:7:"project";s:2:"SC";s:4:"type";i:6;s:7:"summary";s:101:"/Salon Cart/CSC/New User Creation Req_SE_007/SC-21:1 - Executed ON (ISO FORMAT): 2014-05-29 14:39:10";s:11:"description";s:159:"Execution ID: 46 Tester: Preshant Test Plan: SIT Round 1 Build: SIT Round 1 Executed ON (ISO FORMAT): 2014-05-29 14:39:10 Execution Status: passed ";s:9:"issuetype";i:1;}
Can anybody help me out to solve this error?
This occurs when trying to create an issue in testlink.
Well, Jira has its own custom field, the customfield_10000 field that you are looking at is created by you or the someone in your company to track issues.
When you put in a request to create a issue you should provide the values of custom field in order for Jira to process the field.
Just solved this issue myself. You need to add a default value to customfield_10000 as part of your SOAP configuration. For example in your case:
<!-- Template jirasoapInterface -->
<issuetracker>
<username>YOURUSERNAME</username>
<password>YOURPASSWORD</password>
<uribase>JIRASERVER</uribase>
<uriwsdl>JIRASERVER/rpc/soap/jirasoapservice-v2?wsdl</uriwsdl>
<uriview>JIRASERVER/browse/</uriview>
<projectkey>JIRAPROJECT</projectkey>
<issuetype>1</issuetype>
<attributes>
<customFieldValues>
<customField>
<customfieldId>customfield_10000</customfieldId>
<values><value>SOME DEFAULT VALUE</value></values>
</customField>
</customFieldValues>
</attributes>
</issuetracker>

Django : Setting a generic (content_type) field with a real object sets it to None

Update 3 (Read This First) :
Yes, this was caused by the object "profile" not having been saved. For those getting the same symptoms, the moral is "If a ForeignKey field seems to be getting set to None when you assign a real object to it, it's probably because that other objects hasn't been saved."
Even if you are 100% sure that it was saved, check again ;-)
Hi,
I'm using content_type / generic foreign keys in a class in Django.
The line to create an instance of the class is roughly this :
tag = SecurityTag(name='name',agent=an_agent,resource=a_resource,interface=an_interface)
Where both agent and resource are content_type fields.
Most of the time, this works as I expect and creates the appropriate object. But I have one specific case where I call this line to create a SecurityTag but the value of the agent field seems to end up as None.
Now, in this particular case, I test, in the preceding line, that the value of an_agent does contain an existing, saved Django.model object of an agent type. And it does.
Nevertheless, the resulting SecurityTag record comes out with None for this field.
I'm quite baffled by this. I'm guessing that somewhere along the line, something is failing in the ORM's attempt to extract the id of the object in an_agent, but there's no error message nor exception being raised. I've checked that the an_agent object is saved and has a value in its id field.
Anyone seen something like this? Or have any ideas?
====
Update : 10 days later exactly the same bug has come to bite me again in a new context :
Here's some code which describes the "security tag" object, which is basically a mapping between
a) some kind of permission-role (known as "agent" in our system) which is a generic content_type,
b) a resource, which is also a generic content_type, (and in the current problem is being given a Pinax "Profile"),
and c) an "interface" (which is basically a type of access ... eg. "Viewable" or "Editable" that is just a string)
class SecurityTag(models.Model) :
name = models.CharField(max_length='50')
agent_content_type = models.ForeignKey(ContentType,related_name='security_tag_agent')
agent_object_id = models.PositiveIntegerField()
agent = generic.GenericForeignKey('agent_content_type', 'agent_object_id')
interface = models.CharField(max_length='50')
resource_content_type = models.ForeignKey(ContentType,related_name='security_tag_resource')
resource_object_id = models.PositiveIntegerField()
resource = generic.GenericForeignKey('resource_content_type', 'resource_object_id')
At a particular moment later, I do this :
print "before %s, %s" % (self.resource,self.agent)
t = SecurityTag(name=self.tag_name,agent=self.agent,resource=self.resource,interface=self.interface_id)
print "after %s, %s, %s, %s" % (t.resource,t.resource_content_type,type(t.resource),t.resource_object_id)
The result of which is that before, the "resource" variable does reference a Profile, but after ...
before phil, TgGroup object
after None, profile, <type 'NoneType'>, None
In other words, while the value of t.resource_content_type has been set to "profile", everything else is None. In my previous encounter with this problem, I "solved" it by reloading the thing I was trying to assign to the generic type. I'm starting to wonder if this is some kind of ORM cache issue ... is the variable "self.resource" holding some kind proxy object rather than the real thing?
One possibility is that the profile hasn't been saved. However, this code is being called as the result of an after_save signal for profile. (It's setting up default permissions), so could it be that the profile save hasn't been committed or something?
Update 2 : following Matthew's suggestion below, I added
print self.resource._get_pk_value() and self.resource.id
which has blown up saying Profile doesn't have _get_pk_value()
So here's what I noticed passing through the Django code: when you create a new instance of a model object via a constructor, a pre-init function called (via signals) for any generic object references.
Rather than directly storing the object you pass in, it stores the type and the primary key.
If your object is persisted and has an ID, this works fine, because when you get the field at a later date, it retrieves it from the database.
However -- if your object doesn't have an ID, the fetch code returns nothing, and the getter returns None!
You can see the code in django.contrib.contenttypes.generic.GenericForeignKey, in the instance_pre_init and __get__ functions.
This doesn't really answer my question or satisfy my curiosity but it does seem to work if I pull the an_agent object out of the database immediately before trying to use it in the SecurityTag constructor.
Previously I was passing a copy that had been made earlier with get_or_create. Did this old instance somehow go out of date or scope?