BulkUpdateCustomProperties Activity

Purpose: This activity updates multiple custom properties in a SolidWorks document at once. It accepts a JSON string containing a dictionary of property names and values, making it efficient for bulk updates.

Input Properties

DocumentId

ID of an open SolidWorks document. This should be the document ID returned by activities like OpenSolidWorksFile or GetActiveDoc.

Type: string

Required: Yes

Example: "doc-12345"

PropertiesJson

The custom properties as a JSON string in dictionary format. Each key is a property name and each value is the property value.

Type: string

Required: Yes

Example: {"Material": "Steel", "Part Number": "PN-12345", "Revision": "A"}

Note: The JSON must be a valid dictionary/object format with string keys and string values.

Output Properties

Success

Indicates whether all properties were updated successfully.

Type: bool

Note: Returns false if the DocumentId or PropertiesJson is null/empty, if JSON parsing fails, or if the update operation fails.

UpdatedCount

Number of properties successfully updated. This will be 0 if the operation failed.

Type: int

Note: If Success is true, this will equal the number of properties in the JSON. If false, this will be 0.

Usage Example

Scenario: Update multiple custom properties of a SolidWorks part at once

Configuration:
- DocumentId: "doc-12345"
- PropertiesJson: "{\"Material\": \"Stainless Steel\", \"Part Number\": \"PN-12345\", \"Revision\": \"B\", \"Description\": \"Main Assembly\"}"

Result:
- Success: true (if all properties were updated successfully)
- UpdatedCount: 4 (number of properties updated)

Next Steps:
Use the Success and UpdatedCount outputs to verify all properties were updated before proceeding.

Error Handling

Important: The activity handles errors gracefully:

  • If DocumentId or PropertiesJson is null or empty, Success will be false and UpdatedCount will be 0
  • If the JSON string is invalid or cannot be deserialized, Success will be false and UpdatedCount will be 0
  • If the properties dictionary is empty, Success will be false and UpdatedCount will be 0
  • Any exceptions during the update operation will be caught and Success will be set to false

Always check the Success output to ensure all properties were updated successfully before using the document in subsequent activities.

Important Notes

  • The document must be open in SolidWorks and accessible via the DocumentId
  • The JSON format must be a valid dictionary: {"Key1": "Value1", "Key2": "Value2"}
  • If a property does not exist, it will be created with the specified value
  • If a property already exists, its value will be overwritten with the new value
  • Property names are case-sensitive in SolidWorks
  • This activity is more efficient than using AddOrUpdateCustomProperty multiple times
  • All properties are updated in a single operation - either all succeed or all fail

Related Activities